[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Universally quantified test of child attribute pr

Subject: Re: Universally quantified test of child attribute presence/absence
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Tue, 20 Mar 2007 14:21:34 +0100
Re:  Universally quantified test of child attribute  pr
Yves Forkl wrote:


Like I (partially) wrote, I prefer to leave the condition equalling this third case implied in my xsl:otherwise clause, while explicitly testing for the other two cases using xsl:when.


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.


Cheers,
-- Abel Braaksma
  http://www.nuntia.nl

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.