[xsl] Document function (was Getting an error with a variable)

Subject: [xsl] Document function (was Getting an error with a variable)
From: "Garry Searle" <garry@xxxxxxxxxxxxxxxxxx>
Date: Sat, 29 Jul 2006 18:18:07 +0930
Thanks Colin

I looked into the document function and got it working. The xml file will
always be the same, so no need to pass the url in a parameter. This is a
snippet of code. Am I on the right track or is there a more efficient way?

  <xsl:for-each
select="/legs/competition/leg/Competitor[../../@name=$paramVal1]">
  <tr>
    <td><xsl:value-of select="@no"/></td>
	<xsl:variable name="cNum">
	    <xsl:value-of select="@no"/>
	</xsl:variable>
    <td><xsl:value-of
select="document('EntryList.xml')/entrylist/competition/entry/@driverSurname
[../@no=$cNum]"/>
    <td><xsl:value-of
select="document('EntryList.xml')/entrylist/competition/entry/@coDriverSurna
me[../@no=$cNum]"/>
    <td><xsl:value-of select="@stageTime"/>&#160;</td>
    <td><xsl:value-of select="@penaltyTime"/>&#160;</td>
    <td><xsl:value-of select="@totalTime"/>&#160;</td>

Thanks
Garry

-----Original Message-----
From: Colin Paul Adams [mailto:colin@xxxxxxxxxxxxxxxxxx]
Sent: Saturday, 29 July 2006 4:13 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Getting an error with a variable


>>>>> "Garry" == Garry Searle <garry@xxxxxxxxxxxxxxxxxx> writes:

    Garry> I'm wanting to combine 2 xml files. One has a list of car
    Garry> number and competitor names, the other is a list of
    Garry> times. Essentially a relational database. I use .asp to
    Garry> pass the xml and xsl files. Is it possible to pass 2 xml
    Garry> files, or how can I access the data from the 2nd xml
    Garry> file. Could you point me to some documentation. I havent
    Garry> been able to find anything.

You could pass the URI of the second file as a stylesheet parameter.
Then use the document() function.
--
Colin Adams
Preston Lancashire

Current Thread