RE: [xsl] Template Matching

Subject: RE: [xsl] Template Matching
From: "Jeffrey Langdon" <jl_xsl@xxxxxxxxxxx>
Date: Thu, 27 Sep 2001 16:48:35 +0000
Mike Kay wrote:

But then I saw:
	<select name="start">
		<option>
			<xsl:value-of select="z:row/@StartTime"/>
		</option>

and that has me worried, because it selects the @StartTime attributes >of all
the rows, and then displays the one that comes first, and ignores the >rest.
In your example they're all the same, so it doesn't matter. But is this
actually the logic thaht's intended?

Actually, No (I am not surprised *you* picked up on that). Eventually the DB is going give me different data that I will have to loop through and show all the options in the select box.


If you have any suggestions on the best way to do that, i.e., for-each or otherwise I would appreciate it.

Thank you,

Jeff Langdon

From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
CC: <jlangdon@xxxxxxxxxxxx>
Subject: RE: [xsl] Template Matching
Date: Thu, 27 Sep 2001 17:34:43 +0100

>
> I have XML coming from a SQL database.  The XSLT checks to see if the
> "IsActive" attribute in the z:row node is true.  If it is,
> then a checkbox
> is ticked.  I am having a little trouble understanding
> matching.  What is
> the most efficent template match for the processor? I can't find a
> definitive answer on what the first template match should be
> compared to the
> second template.  I am using template match="/" for the first
> and template
> match="rs:data" for the second.  Is there a better way?
>
At first glance I thought the structure of this stylesheet looked perfectly
OK.

The tests like
> 		<xsl:if test="z:row[@DayOfTheWeek='Sunday' and
> @IsActive='True']">

are saying "if there is a row with these attributes", which is fine.

But then I saw:
> <select name="start">
> <option>
> <xsl:value-of select="z:row/@StartTime"/>
> </option>
>
and that has me worried, because it selects the @StartTime attributes of all
the rows, and then displays the one that comes first, and ignores the rest.
In your example they're all the same, so it doesn't matter. But is this
actually the logic thaht's intended?


Mike Kay


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




_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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



Current Thread