Subject: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] xsl:function, Michael Kay | Thread | RE: [xsl] xsl:function, Mac Martine |
RE: [xsl] Need to Transform a Flat , Martinez, Brian | Date | [xsl] sort elements based on attrib, Challa, Harsha |
Month |