Subject: Re: [xsl] Universally quantified test of child attribute presence/absence From: Yves Forkl <Y.Forkl@xxxxxx> Date: Tue, 20 Mar 2007 15:08:01 +0100 |
Just a thought, based on what I think to grasp from what you want to do:
<!-- holds a sequence to two numbers, one with @my.. one with all-->
<xsl:variable name="mytest" select="count(*/@my_atrribute), count(*)" as="xs:integer+" />
<!-- choosing between the four possible scenarios. Note: order is important! -->
<xsl:choose>
<xsl:when test="$mytest[1] = $mytest[2]">
<!-- every child has @my_attribute -->
</xsl:when>
<xsl:when test="$mytest[1]">
<!-- some childs has @my_attribute -->
</xsl:when>
<xsl:when test="$mytest[2]">
<!-- no childs have @my_attribute -->
</xsl:when>
<xsl:otherwise>
<!-- no childs at all -->
</xsl:otherwise>
<xsl:choose>
As I said, just a thought, and perhaps way easier to write down and/or to understand. Like Larry Wall said: there's more than one way to do it.
<xsl:choose> <xsl:when test="* and (every $child in * satisfies $child[@my_attribute])"> </xsl:when> <xsl:when test="every $child in * satisfies $child[not(@my_attribute)]"> </xsl:when> <xsl:otherwise> </xsl:otherwise> <xsl:choose>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Universally quantified te, Abel Braaksma | Thread | Re: [xsl] Universally quantified te, Abel Braaksma |
Re: [xsl] Universally quantified te, David Carlisle | Date | Re: [xsl] Universally quantified te, Abel Braaksma |
Month |