[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Limiting XSL Results for Timely Web Page Display

Subject: Re: Limiting XSL Results for Timely Web Page Display
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Wed, 20 Nov 2002 12:54:25 +0100
asp result set
Pass one more param to the XSL:

<xsl:param name="searchphrase" select="'dog'"/>

<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>

Regards,

Joerg

Bruce Dailey wrote:
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.


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.