[xsl] Building RTF variable

Subject: [xsl] Building RTF variable
From: "Ragulf Pickaxe" <jawxml@xxxxxxxxxxx>
Date: Fri, 25 Oct 2002 06:53:41 +0000
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">

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"?>

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

<?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/>
<xsl:for-each select="$unique-countries">
<country name="{.}">
<xsl:for-each select="//city[country=current()]">
<city><xsl:value-of select="@name"/></city>,&#160;
<xsl:copy-of select="$unique-countries"/><br/>
<!-- Gives me all the values in the variable nodeset (RTF?) -->

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

Current Thread