[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

referring to variables using variables?

Subject: referring to variables using variables?
From: "james walker" <jameswalkerandy@xxxxxxxxxxx>
Date: Mon, 12 Jan 2004 13:56:14 +0000
inserting variables in xsl
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:for-each>
<xsl:apply-templates select="./category" />
</xsl:template>
</xsl:stylesheet>

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
cheers
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.