Subject: Re: [xsl] Limiting XSL Results for Timely Web Page Display From: Joerg Heinicke <joerg.heinicke@xxxxxx> Date: Wed, 20 Nov 2002 12:54:25 +0100 |
<xsl:template match="dictionary"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates select="*[contains(text(), $searchphrase)]"/> </xsl:copy> </xsl:template>
<xsl:template match="word"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:attribute name="id"> <xsl:value-of select="position()"/> </xsl:attribute> <xsl:copy-of select="text()"/> </xsl:copy> </xsl:template>
One more related question here - can you return a value in XSL? In this example I want to return the number of records in the result set.
One problem is that the result set is a subset of the elements in the XML file. I need to number on the subset, e.g.
XML:
<dictionary> <word>dog is man's best friend</word> <word>cat</word> <word>dog and cats</word> </dictionary>
If the user searches on "dog" I want the XSL to return:
<html><body> <p> dog is man's best friend</p> <p> dog and cats </p> </body></html>
In other words - don't return the 2nd <word>.
I am thinking that the simplest solution is a two stage process. XML to a result set XML and then XML to HTML, e.g.
<dictionary> <word id=1>dog is man's best friend</word> <word id=2>dog and cats</word> </dictionary>
Then from ASP, I can pass in a 1 and a 20 and it will be very simple code to only return records with id 1 to 20.
But I need XSL to tell ASP how many records in the result set so that I don't put a "forward" button in the HTML code to go to the next 20 records.
Please excuse the simplistic examples, but I am a newbie.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Limiting XSL Results for , Bruce Dailey | Thread | Re: [xsl] Limiting XSL Results for , Bruce Dailey |
Re: [xsl] Limiting XSL Results for , Bruce Dailey | Date | [xsl] Differents between XML-Files, Asim Tozlu |
Month |