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

RE: filter

Subject: RE: filter
From: Paul <reganmian@xxxxxxxxx>
Date: Wed, 4 Dec 2002 10:19:00 -0800 (PST)
RE:  filter
Thanks Tom, you always take sth new to me.

Paul

--- TSchutzerWeissmann@xxxxxxxxxxxxxxxx wrote:
> Hi Paul,
> 
> > and the fact is group element will always apply to
> 
> > a structure:
> 
> > /xs:element/xs:complexType/xs:sequence/xs:element
> with
> > the occuring of @maxOccurs attribute 
> 
> The "/" at the beginning of that XPath is my typo -
> it shouldn't be there
> because it's short for the document root. The only
> element in the schema
> that is a child of / is the top node, xs:schema.
> 
> Group on
>
xs:element[xs:complexType/xs:sequence/xs:element/@maxOccurs].
> You
> don't need "boolean" - if the expression in the
> predicate is the empty
> node-set then it's equivalent to false.
> 
> The negative version of the filter is
> 
>
xs:element[not(xs:complexType/xs:sequence/xs:element/@maxOccurs)]
> 
> This is the modified version...(untested)
> 
>
============================================================
> 
> <xsl:key name="childGroups"
>
match="xs:element[xs:complexType/xs:sequence/xs:element/@maxOccurs]"
>   use="generate-id(
> 	
>
(ancestor::xs:element[xs:complexType/xs:sequence/xs:element/@maxOccurs][1]
> 	| /)[last())"/>
> 
> <!-- the ( xyz | / )[last()] will always give you
> xyz if it exists,
> otherwise the root node. 
> 	This is because the root node is the very first
> node, so any node
> comes later than it 
> 	and will be last of the pair 
> 
> 	So we can refer to the top group using this key and
> the id of the
> root element, instead of
> 	using a long XPath nightmare
> -->
> 
> <xsl:key name="byGroup"
>
match="xs:element[not(xs:complexType/xs:sequence/xs:element/@maxOccurs)]"
>   use="generate-id(
>       
> ancestor-or-self::*/preceding-sibling::xs:element
> 
>
[xs:complexType/xs:sequence/xs:element/@maxOccurs][1]"/>
> 
> <!-- notice that the match is just on xs:element -->
> 
> <xsl:template match="/xs:schema/xs:element">
>   <xsl:apply-templates
> select="key('childGroups',generate-id(/))"
> mode="recurse"/>
> </xsl:template>
> 
> <xsl:template match="xs:element" mode="recurse">
>   <!-- for each group -->
>     <xsl:variable name="me" select="generate-id()"/>
> 
>     Group <xsl:value-of select="@ref"/> Starts     
>     
>     <xsl:apply-templates
> select="key('childGroups',$me)" mode="recurse"/>
>    
>     Group <xsl:value-of select="@ref"/> Ends.
>                                         
>     <xsl:for-each select="key('byGroup',$me)">
>       <xsl:value-of select="@ref"/> Starts
>     </xsl:for-each>
>     
>     <xsl:for-each select="key('byGroup',$me)">
>       <xsl:value-of select="@ref"/> Ends
>     </xsl:for-each>
> 
> </xsl:template>
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • Re: filter, (continued)
        • Paul - Tue, 3 Dec 2002 18:24:26 -0500 (EST)
    • TSchutzerWeissmann - Wed, 4 Dec 2002 06:15:23 -0500 (EST)
      • Paul - Wed, 4 Dec 2002 08:47:22 -0500 (EST)
    • TSchutzerWeissmann - Wed, 4 Dec 2002 10:28:01 -0500 (EST)
      • Paul - Wed, 4 Dec 2002 13:13:48 -0500 (EST) <=
        • Paul - Wed, 4 Dec 2002 14:39:48 -0500 (EST)

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.