Subject: match attribute values
From: "Mac Martine" <email@xxxxxxxxxxxxxxxx>
Date: Thu, 27 Mar 2003 13:08:03 -0800
|
Hello-
I am trying to find all values of a specified attribute and sort them
in order. I know this is normally really easy, but I add one complicated
factor. Sometimes the attribute will have multiple values separated by a
','. I am assigning certain elements a task number, but some elements
will have multiple task numbers. So I need to go through and find which
elements holds the certain value that I am looking for. I am only
supplying the stripped code for the issue I am having (I have not
included the string splitting code, etc). With the code below I get a
recursion error. So, I basically need to find the element where @task =
1, then where @task = 2, @task = 3 and so on. So, any help would be
appreciated, or any more clever approaches than what I am attempting
here. Thanks-
Mac
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<body>
<table width="80%">
<xsl:apply-templates select="//*[@task = 1]">
<xsl:with-param name="nextTask" select="1"/>
</xsl:apply-templates>
</table>
</body>
</xsl:template>
<xsl:template match="*">
<xsl:param name="nextTask"/>
<br />
-->> @TASK = <xsl:value-of select="@task" /> : $NEXTTASK =
<xsl:value-of select="$nextTask" />
<xsl:if test="@task = $nextTask">
(<xsl:value-of select="local-name()" />)
</xsl:if>
<xsl:apply-templates select="//*[@task=2]">
<xsl:with-param name="nextTask" select="2"/>
</xsl:apply-templates>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- Re: xsl:function, (continued)
- Jeni Tennison - Wed, 26 Mar 2003 16:55:27 -0500 (EST)
- Mac Martine - Wed, 26 Mar 2003 17:52:26 -0500 (EST)
- Jeni Tennison - Thu, 27 Mar 2003 04:31:58 -0500 (EST)
- Michael Kay - Thu, 27 Mar 2003 05:36:24 -0500 (EST)
- Mac Martine - Thu, 27 Mar 2003 16:04:29 -0500 (EST) <=
- Mac Martine - Fri, 28 Mar 2003 13:44:43 -0500 (EST)
- Michael Kay - Fri, 28 Mar 2003 14:36:46 -0500 (EST)
- Mac Martine - Fri, 28 Mar 2003 15:19:17 -0500 (EST)
- Jeni Tennison - Fri, 28 Mar 2003 16:09:35 -0500 (EST)
|
|