|
Subject: Re: [xsl] composing file reference for document() based on xml input From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx> Date: Thu, 10 May 2001 17:18:32 -0400 |
[Joel P Thornton]
> I'm trying to piece together a file reference for use in a document() call
> in my XSL. I want to specify part of the referenced document's path via a
> text node from my xml input tree.
>
> Here is what I've got so far, but it does not work:
>
> <xsl:copy-of select="document({/root/state/site/physical-site/root} +
> '/xml/navigation.xml')"/>
>
> So, if the text node at /root/state/site/physical-site-root is
> 'c:/inetpub/wwwroot', then I want the argument to my document() function
to
> be 'c:/inetpub/wwwroot/xml/navigation.xml'. I'm just not quite sure what
> the right syntax is for doing this.
>
It doesn't work because the attribute template mechanism (with the curly
braces {}) is for putting attribute values into the output tree, not into
xslt instructions.
I just tested this and it works (msxml3 and saxon both):
<xsl:variable name='half-path'
select='/root/state/site/physical-site/root'/>
<xsl:variable name='full-path'
select="concat($half-path,'/xml/navigation.xml')"/>
<xsl:copy-of select='document($full-path)'/>
Here's the xml file I used with this stylesheet:
<root>
<state>
<site>
<physical-site>
<root>file:///d:\test</root>
</physical-site>
</site>
</state>
</root>
You could skip the variables and do everything at once, but this way it's a
lot easier to understand what's being done.
Cheers,
Tom P
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] parameters from Javascrip, Gitanjali | Thread | RE: [xsl] composing file reference , Michael Kay |
| [xsl] UTF-8 Output, Jim Schmidt | Date | Re: [xsl] apply-templates, rule-bas, Thomas B. Passin |
| Month |