Folks,
I'm trying to get something done in XSL and either I'm just missing
some silly thing, or it's not possible to do it.... which is it???
What I'm trying to do is have a XML document that (to some degree)
describes a report - basically, it's a collection of labels and XPath
references of where in the XML document to find the values for those
labels. Seems pretty simple and straightforward, and looks something
like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
<reportstruct>
<firstpage>
<items>
<item>
<label>Label 1</label>
<ref>/dbdata/basic/item1</ref>
</item>
<item>
<label>Label 2</label>
<ref>//dbdata/basic/item2</ref>
</item>
</items>
</firstpage>
</reportstruct>
<dbdata>
<basic>
<item1>10299</item1>
<item2>1.850.897</item2>
</basic>
</dbdata>
</root>
So what I'd like to see in my final HTML is a table with all the
labels as defined in the "root/reportstruct/items" collection, and
their associated value as specified in the "ref" element for each
<item>.
My XSL for that part looks something like this:
<table width="100%">
<xsl:for-each select="root/reportstruct/firstpage/items/item">
<tr>
<td style="font-weight: bold" width="50%">
<xsl:value-of select="label" />
</td>
<td>
<xsl:variable name="DataRef"
select="ref" />
<xsl:value-of select="{$DataRef}" />
</td>
</tr>
</xsl:for-each>
</table>
So give me all the <item> nodes, display the "label" element in the
first data cell, grab the reference (XPath expression) for the value,
and display that one in the second data cell.
Unfortunately, I can't seem to get it to work - trying to
XSL-transform this with MSXSL keeps telling me that the {$DataRef} is
not a valid XPath expression, that it contains "an illegal token" (but
fails to say WHAT that token is!).
Any ideas?? I must be really either not seeing something very basic,
or something is screwy.....
Any hints are most welcome!!
Marc
================================================================
Marc Scheuner May The Source Be With You!