Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbscript in xsl

Status
Not open for further replies.

mgriffith

MIS
Jul 3, 2001
177
US
i have been using basic xml on my navigation bar system...i have a couple of different navigation bars...the xml file for the navigation bar is selected through an asp script then parsed with a stylesheet throught the asp. i want to convert my entire site to xml. how can i write a script in the main xsl to choose which navbar to include? it uses request.querystring, session variables, and a few other basic vbscript commands. can i combine xsl:script and xsl:include and if so, how would i go about doing that?

here's basically what i have now

asp file for page i want to display
...<td><!--#include virtual=&quot;/Menu/navbar.asp&quot;--></td>...

navbar.asp
...if Request.QueryString(&quot;campus&quot;).Count > 0 then session(&quot;person&quot;)=&quot;campus&quot; end if...
...if session(&quot;person&quot;)=&quot;campus&quot; then
varfile=&quot;campus.xml&quot;...
...set xml = Server.CreateObject(&quot;Microsoft.XMLDOM&quot;)
xml.async = false
xml.load(Server.MapPath(&quot;/Menu/&quot; & varfile))
set xsl = Server.CreateObject(&quot;Microsoft.XMLDOM&quot;)
xsl.async = false
xsl.load(Server.MapPath(&quot;/Menu/menu.xsl&quot;))
Response.Write(xml.transformNode(xsl))

the stylesheet and xml are very basic...they just write out a fancy table using <menuitem>'s in the xml file


thanks for all your help
 
mgriffith,

have you tried

<msxsl:script> tag

here is an example:

<?xml version=&quot;1.0&quot; encoding=&quot;iso-8859-1&quot;?>
<?xml-stylesheet type=&quot;text/xsl&quot; href=&quot;conversion.xsl&quot;?>
<dimension>
the size of the pictures are<inches>5<inches> by <inches>12</inches>
</dimension>
</xml>

this is the conversion.xsl

<xsl:stylesheet
xmlns:xsl=&quot; version=&quot;1.0&quot;
xmlns:extra=&quot;urn:extra-function&quot;
>
<msxml:script xmlns:msxsl=&quot;urn:schemas-microsoft-com:xslt&quot;
language:&quot;VBScript&quot;
implements-prefix=&quot;extra&quot;
>

Function ToMM(inches)
ToMM= inches * 2.54
End Function


</msxsl:script>
<xsl:eek:uput method=&quot;html&quot;/>
<xsl:template match=&quot;/&quot;>
<html><body><p>
<xsl:apply-templates/>
</p></body></html>
</xsl:template>
<xsl:template match=&quot;inches&quot;>
<xsl:text> </xsl:text>
<xsl:value-of select=&quot;format-number(extra:ToMM(number(.)),'0.00)&quot;/>
<xsl:text>mm </xsl:text>
</xsl:template>
</xsl:stylesheet>

this would be the converted text:
The size of the picture is 127.00mm by 304.00mm.


msxsl:script can also call COM/COM+ objects if they are part of the registry.
This can be added to your asp files as well by the calling the xsl file


Aaron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top