🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.csharpbuilder.xml
1 messages
1 total messages Started by Marc Scheuner Fri, 18 Jun 2004 06:22
XSL not working as expected
#1
Author: Marc Scheuner
Date: Fri, 18 Jun 2004 06:22
76 lines
3090 bytes
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!
Bern, Switzerland                         m.scheuner(at)inova.ch
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads