xsl-list
[Top] [All Lists]

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

2006-07-29 02:02:51
"Garry" == Garry Searle <garry(_at_)justimagine(_dot_)com(_dot_)au> 
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--