[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Using URL parameters in XSL


Subject: Re: [xsl] Using URL parameters in XSL
From: "Huw Wilkins" <htaw@xxxxxxxxxxxxxxx>
Date: Mon, 11 Aug 2003 18:26:41 +0100

Julian,

If you're using MSXML you can access the URLs used to load both the XML
document and the XSL stylesheet with a script. It currently returns the full
path to each document, including any query string parameters. To access them
individually you'd need to do some string thrashing, but the basics are
here.

You couldn't use this to load values into parameters, but it will be
possible to populate values for variables, or even build an RTF of the
parameters and access that.

Example stylesheet:

<xsl:stylesheet version="1.0"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            xmlns:msxsl="urn:schemas-microsoft-com:xslt"
            xmlns:path="urn:test"
>

            <xsl:output method="html"/>

            <msxsl:script implements-prefix="path" language="JScript">
                        function URL(oObj) {
						// Assumes oObj is an IXMLDOMNodeList - smarter type checking might be
advisable in a production environment.
                                    return oObj.item(0).url;
                        }
            </msxsl:script>

            <xsl:template match="/">
				Path of XSL Stylesheet document:<br/>
                        <xsl:value-of select="path:URL(document(''))"/>
                        <br/>
				Path of XML Document:<br/>
                        <xsl:value-of select="path:URL(.)"/>
            </xsl:template>

</xsl:stylesheet>

Hope this helps.

Regards,
Huw Wilkins


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords