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

XPath Predicate Nuance

Subject: XPath Predicate Nuance
From: "David P. Nesbitt" <david_p_nesbitt@xxxxxxxxx>
Date: Wed, 6 Oct 2004 15:13:47 -0700 (PDT)
xsl predicate
I am getting some unexpect results from an XPath
predicate.  I am trying to load the unique values of
an element into a variable.  The XML file is grouped
by this element.  I want to treat the absence of the
element as a value as well (the "null" value if you
will).  However, I can't get the XPath predicate to
filter out multiple "null" values.
 
I am including below a data file, stylesheet, expected
output and observed output.  If you can see anything
wrong, I would most appreciate your assistance.
  
Regards,
Dave


XML File:
---------
 
<a>
 <b>
  <c>123</c>
  <d>000</d>
 </b>
 <b>
  <c>123</c>
  <d>000</d>
 </b>
 <b>
  <d>000</d>
 </b>
 <b>
  <d>000</d>
 </b>
 <b>
  <c>456</c>
  <d>000</d>
 </b>
 <b>
  <c>456</c>
  <d>000</d>
 </b>
 <b>
  <c>789</c>
  <d>000</d>
 </b>
</a>

 
XSL File:
---------
 
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="text"/>
 <xsl:template match="a">
   <xsl:variable name="unique-cs" 
select="/a/b[(not(boolean(preceding-sibling::b)) or
(not(boolean(c)) and preceding-sibling::b/c) or 
(boolean(c) and not(c=preceding-sibling::b/c)))]"/>
   <xsl:for-each select="$unique-cs">
    <xsl:value-of select="c"/>
    <xsl:text>
 </xsl:text>
   </xsl:for-each>
 </xsl:template>
</xsl:stylesheet> 


Expected output:
----------------
 
123
 
 456
 789
 
 
Observed output:
----------------
 
123
 
 
 456
 789
 



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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.