xsl-list
[Top] [All Lists]

Need help using variable in select statement

2005-09-26 07:38:22
I'm trying to mimic the functionality of a tag used in documenting .NET C# code. The tag identifies a file and path location of xml content to merge into the source document.

<include file="content.xml" path="/Top/Child[(_at_)name='Me']/*" />

The template that I have written to translate this tag is simply:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ Transform">
    <xsl:template match="include">
        <xsl:variable name="file" select="@file"/>
        <xsl:variable name="path" select="@path"/>
        <xsl:copy-of select="document($file)$path"/>
    </xsl:template>
</xsl:stylesheet>

The problem is that the use of the $path variable in the "select=" statement seems to violate some syntax rule and all I get is a complaint about an unexpected token on that line.

Now if I substitute the variable value "Top/Child[(_at_)name='Me']/*" in place of the "$path" variable, the template works as expected.

I've tried a number of ways to build the select statement, but none have worked out. Any suggestions?

Thanks,
Frank




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>