RE: [xsl] XPath Query

Subject: RE: [xsl] XPath Query
From: Rene de Vries <RdVries@xxxxxxxxxxx>
Date: Mon, 16 Jul 2001 11:04:37 +0200
Hi Bryan,

Think in templates!!!! xsl:call-template is only used for universal functions which you want to use at several places.

	<xsl:template match="DATA">
		<table border="1">
			<xsl:apply-templates select="HISTORY"/>
	<xsl:template match="HISTORY">
		<xsl:variable name="NameCode" select="NAME"/>
				<xsl:value-of select="DESCRIPTION"/>
				<xsl:value-of select="//DATA/NAME[@CODE=$NameCode]"/>

Greetings Rene
   { @   @ }

"You don't need eyes to see, you need vision!"

-----Oorspronkelijk bericht-----
Van:	Bryan Tulloch [SMTP:b.tulloch@xxxxxxxxxxxxx]
Verzonden:	maandag 16 juli 2001 10:45
Aan:	'XSL-List@xxxxxxxxxxxxxxxxxxxxxx'
Onderwerp:	[xsl] XPath Query


I have tried to get the following to work, but thus far have only been able
to get part of the output I need.


		<DESCRIPTION>This is a history item 1</DESCRIPTION>
		<DESCRIPTION>This is a history item 2</DESCRIPTION>
		<DESCRIPTION>This is a history item 3</DESCRIPTION>
		<DESCRIPTION>This is a history item 4</DESCRIPTION>
		<DESCRIPTION>This is a history item 5</DESCRIPTION>

	<NAME CODE="21">
		<PERSON>Fred Bloggs</PERSON>
	<NAME CODE="22">
		<PERSON>John Smith</PERSON>
	<NAME CODE="24">
		<PERSON>Fred Jones</PERSON>

My desired output:

<TR><TD>This is a history item 1</TD><TD>Fred Bloggs</TD></TR>
<TR><TD>This is a history item 2</TD><TD>John Smith</TD></TR>
<TR><TD>This is a history item 3</TD><TD>Fred Bloggs</TD></TR>
<TR><TD>This is a history item 4</TD><TD>Fred Jones</TD></TR>
<TR><TD>This is a history item 5</TD><TD>Fred Bloggs</TD></TR>

My XSL (below) displays the description in the first column of the table.
However, I have not been able to find the correct XPath expression to put
the data needed for the second column into the table. I imagine that I need
to call another template such as "third" below, but don't know what to put
in it. By the way, I have spent several hours trying to solve this one, so
I'm not just being lazy!

<?xml version="1.0" encoding="utf-8"?>

<xsl:transform version="1.0"

<xsl:variable name="items"

<xsl:template match="/">
<xsl:call-template name="second" />

<xsl:template name="second">
<xsl:for-each select="//DATA[./NAME/@CODE=$items]/HISTORY">
<xsl:value-of select="DESCRIPTION" />
<xsl:call-template name="third" />

<xsl:template name="third">



 XSL-List info and archive:

 XSL-List info and archive:

Current Thread