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

Subject: Re: [xsl] Document function (was Getting an error with a variable)
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: 29 Jul 2006 10:02:57 +0100
>>>>> "Garry" == Garry Searle <garry@xxxxxxxxxxxxxxxxxx> writes:

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

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

I don't know about whether or not it would be more efficient, but I
would set a variable for the common path expression document('EntryList.xml')/entrylist/competition/entry.
-- 
Colin Adams
Preston Lancashire

Current Thread