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

RE: XPath condition supplied as a parameter

Subject: RE: XPath condition supplied as a parameter
From: Maulik Modi <MModi@xxxxxxxxxx>
Date: Wed, 23 Oct 2002 10:09:19 -0500
xpath condition
Look up the extension function evaluate(). I know both Saxon and Xalan
provide this. I am not sure which processor you used.

-Maulik

-----Original Message-----
From: Chris Gill [mailto:chris.gill@xxxxxxxxxxx]
Sent: Wednesday, October 23, 2002 10:03 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  XPath condition supplied as a parameter 


I am getting the feeling that this is not possible but I would like
someone to confirm for me

I am trying to write a generic template to create a table with the first
column spanned over all rows in HTML. The code below works apart from
the condition is ignored. From reading around, I am getting the
impression that I cannot do this.

Any help much appreciated

----------------------------------------------------------------
<!--
data_tag is the name of the XML node to be included in the table
data_condition is the string that should form the condition to subset
the data

-->

	<xsl:template name="table_spanned">
		<xsl:param name="first_col_width"/>
		<xsl:param name="first_col_text"/>
		<xsl:param name="data_tag"/>
		<xsl:param name="data_condition"/>

		
		<table>
			<!-- Count rows -->
			<xsl:variable name="numrow"
select="count(child::*[name()=$data_tag][$data_condition])"/>
			
			<!-- Store first element value -->
			<xsl:variable name="FirstAnswer"
select="(child::*[name()=$data_tag][$data_condition])[1]/@ANSWERNAME"/>
			<tr>
				<!-- First table element with correct
rowspan value -->
				<xsl:element name="td">
					<xsl:attribute
name="width"><xsl:value-of select="$first_col_width"/></xsl:attribute>
					<xsl:attribute
name="rowspan"><xsl:value-of select="$numrow"/></xsl:attribute>
						<xsl:value-of
select="$first_col_text"/>					
					</xsl:element>
				<td>
					<!-- First element -->
					<xsl:value-of
select="$FirstAnswer"/>
				</td>
			</tr>
			<!-- All elements that are not the first element
-->
			<xsl:for-each
select="(child::*[name()=$data_tag][$data_condition])[@ANSWERNAME !=
$FirstAnswer]">
				<tr>
					<td>
						<xsl:value-of
select="@ANSWERNAME"/>
					</td>
				</tr>
			</xsl:for-each>
		</table>

	</xsl:template>

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

 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.