[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Building RTF variable
Hello all
I don't know if the title is totally appropriate, but let me tell you of my problem: I would like to create a nodeset for a variable, something like: <xsl:variable name="Test"> <node>Number1</node> <node>Number2</node> <node>Number3</node> </xsl:variable> But I don't have very much success. I would like to be able to do, say: <xsl:value-of select="$Test[1]"/> but this does not work. What am I doing wrong? I have tried all kinds of changes - putting in a root node and all other such things. Thanks in advance Ragulf Pickaxe :) I have an example, I think originally taken from Michael Kay's book, looking like the following (which works but I can't input from an XML file, I need to build the variable in the XSL only): XML document: <?xml version="1.0" encoding="ISO-8859-1"?> <?xml:stylesheet type="text/xsl" href="jawgroup2.xsl"?> <cities> <city name="Paris"><country>France</country></city> <city name="Roma"><country>Italia</country></city> <city name="Nice"><country>France</country></city> <city name="Madrid"><country>Espana</country></city> <city name="Milano"><country>Italia</country></city> <city name="Firenze"><country>Italia</country></city> <city name="Napoli"><country>Italia</country></city> <city name="Lyon"><country>France</country></city> <city name="Barcelona"><country>Espana</country></city> </cities> <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'> <xsl:output method="html" encoding="ISO-8859-1" indent="yes"/> <!-- Content of stylesheet. --> <xsl:template match="/"> <xsl:variable name="unique-countries" select="/cities/city[not(country=preceding-sibling::city/country)]/country"/> <xsl:value-of select="$unique-countries"/><br/> <!-- same as <xsl:value-of select="$unique-countries[1]"/> --> <xsl:value-of select="$unique-countries[3]"/><br/> <countries> <xsl:for-each select="$unique-countries"> <country name="{.}"> <xsl:for-each select="//city[country=current()]"> <city><xsl:value-of select="@name"/></city>,  </xsl:for-each> </country> <br/> </xsl:for-each> </countries> <xsl:copy-of select="$unique-countries"/><br/> <!-- Gives me all the values in the variable nodeset (RTF?) --> </xsl:template> </xsl:stylesheet> _________________________________________________________________ Get a speedy connection with MSN Broadband.? Join now! http://resourcecenter.msn.com/access/plans/freeactivation.asp XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|