[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] shortest way to write this xsl:if statement


Subject: Re: [xsl] shortest way to write this xsl:if statement
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Fri, 15 Jun 2012 14:30:05 +0100

On 15 June 2012 14:24, henry human <henry_human@xxxxxxxx> wrote:
> sorry, but the resul with the xpath- query is the same. The if statement is ended after first finding of 'A'
>
> but there are at least for findings for B, C, D which should lead to creation of the code bellow of th if-statement
> ??

Put the xpath in an apply-templates:

<xsl:apply-templates select=" the xpath to select the elements goes here "/>

and then add a template:

<xsl:template match=" the match pattern ">

</xs:template>

Don't use for-each.  You might need to add a mode if you already have
templates matching the elements you are processing here.

You don't need the if test because if the apply-templates selects
nothing, nothing will get processed.

-- 
Andrew Welch
http://andrewjwelch.com


Current Thread
Keywords