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

[xsl] referring to variables using variables?

Subject: [xsl] referring to variables using variables?
From: "james walker" <jameswalkerandy@xxxxxxxxxxx>
Date: Mon, 12 Jan 2004 13:56:14 +0000

I am trying to access different xml documents where the variable name of the document (declared at the top of the file) is equal to the category name of the file being translated:
e.g. given this xslt:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="jaka" select="document('http:......')" />
<xsl:variable name="foobar" select="document('http:......')" />

<xsl:template match="category">
<xsl:variable name="catname" select="name" />
<xsl:for-each select="$catname/root/child::*)">
<li><xsl:value-of select="detail" /></li>
<xsl:apply-templates select="./category" />

I translated this with file1.xml which contained the two category names jaka aand foobar. i have named the categories in the file1.xml to be $foobar and $jaka so when $catname is substitued into $catname/root/child::* it should look like $foobar/root/child::* for foobar categoyr and $jaka/root/child::* for jaka category.

However, when i translate it, it doesnt seem to show anything when it gets to the xpath staement $catname/root/child::*.
I tested to see if it works when u put the variable name directly in there and it does (e.g. putting $foobar/root/child::* )??
Does anyone know if i am close to the solution (am i making a silly mistake with variable decalration?0
james walker

Express yourself with cool emoticons - download MSN Messenger today! http://www.msn.co.uk/messenger

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

Current Thread