Subject: Re: [xsl] Testing implicit XHTML hierarchy From: "bryan rasmussen" <rasmussen.bryan@xxxxxxxxx> Date: Thu, 5 Jul 2007 02:09:07 +0200 |
well i agree there is redundancy (damn I should really do this stuff instead of messing around )
<xsl:variable name="h" select="//xhtml:*[matches(local-name(),'^h[1-6]')]/number(substring(local-name(),2))"/>
<xsl:for-each select="1 to count($h)-1"> <result select="$h[.+1][1]">
<xsl:value-of select="$h[.+1][1]"/> </result> <result select="$h[.][1]">
<xsl:value-of select="$h[.][1]"/> </result> <result select="$h[.+1][2]"> <xsl:value-of select="$h[.+1][2]"/> </result> <result select="$h[.][2]"><xsl:value-of select="$h[.][2]"/> </result> </xsl:for-each> </output> </xsl:template>
<?xml version="1.0" encoding="UTF-8"?> <output> <result select="$h[.+1][1]">2</result> <result select="$h[.][1]">1</result> <result select="$h[.+1][2]">5</result> <result select="$h[.][2]">2</result> <result select="$h[.+1][1]">2</result> <result select="$h[.][1]">1</result> <result select="$h[.+1][2]">5</result> <result select="$h[.][2]">2</result> <result select="$h[.+1][1]">2</result> <result select="$h[.][1]">1</result> <result select="$h[.+1][2]">5</result> <result select="$h[.][2]">2</result> <result select="$h[.+1][1]">2</result> <result select="$h[.][1]">1</result> <result select="$h[.+1][2]">5</result> <result select="$h[.][2]">2</result> <result select="$h[.+1][1]">2</result> <result select="$h[.][1]">1</result> <result select="$h[.+1][2]">5</result> <result select="$h[.][2]">2</result> <result select="$h[.+1][1]">2</result> <result select="$h[.][1]">1</result> <result select="$h[.+1][2]">5</result> <result select="$h[.][2]">2</result> <result select="$h[.+1][1]">2</result> <result select="$h[.][1]">1</result> <result select="$h[.+1][2]">5</result> <result select="$h[.][2]">2</result> <result select="$h[.+1][1]">2</result> <result select="$h[.][1]">1</result> <result select="$h[.+1][2]">5</result> <result select="$h[.][2]">2</result> </output>
Since there are two items in the sequence I mean. Sorry if I'm not very clear right now, but I am not thinking especially sharpish.
Cheers, Bryan Rasmussen
> actually theres more than one item in your sequence that way. I may have mistyped, but you shouldn't need the [1]'s in for example $h[.+1][1] as $h[.+1] is %h[position()=.+1] so can return at most 1 item, so [1] is redundant. similarly $h[.+1][2] will always be empty.
David
________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Testing implicit XHTML hi, David Carlisle | Thread | Re: [xsl] Testing implicit XHTML hi, bryan rasmussen |
Re: [xsl] Testing implicit XHTML hi, David Carlisle | Date | Re: [xsl] Testing implicit XHTML hi, bryan rasmussen |
Month |