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

further group sequence problem

Subject: further group sequence problem
From: Paul <reganmian@xxxxxxxxx>
Date: Tue, 26 Nov 2002 17:37:05 -0800 (PST)
sequence problem
Hi

Further to group sequence problem(xsl for schema), Is
it possible to adjust the key setting, to let  
PET starts1 
MAID starts1 
PET ends1 
MAID ends1 
occur after name, before phone(in sequence)

thanks !!
Paul

======== schema =======
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
	<xs:element name="MSG">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="GRP"/>
				<xs:element ref="NAME"/>
				<xs:sequence minOccurs="0">
					<xs:element ref="PET"/>
					<xs:element ref="MAID"/>
				</xs:sequence>
				<xs:element ref="PHONE"/>
				<xs:element ref="E-MAIL"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>


====== style sheet =========
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<xsl:output method="html" indent="no"/>
	<xsl:key name="elements" match="xs:element"
use="generate-id((preceding-sibling::xs:element |
self::xs:element) [starts-with(@ref,
'GRP')][last()])"/>
	<xsl:key name="at" match="element" use="@name"/>
	<xsl:template match="xs:element" mode="group">
		<xsl:apply-templates select="." mode="start"/>
		<xsl:apply-templates select="." mode="end"/>
		<xsl:apply-templates select="key('elements',
generate-id())[generate-id() !=
generate-id(current())]" mode="start"/>
		<xsl:apply-templates select="key('elements',
generate-id())[generate-id() !=
generate-id(current())]" mode="end"/>
	</xsl:template>
	<xsl:template match="xs:element" mode="start">
		<xsl:value-of select="@ref"/>
		<xsl:text> starts1 &#10; </xsl:text>
	</xsl:template>
	<xsl:template match="xs:element" mode="end">
		<xsl:value-of select="@ref"/>
		<xsl:text> ends1 &#10;</xsl:text>
	</xsl:template>
	<xsl:template match="xs:sequence">
		<xsl:if test="ancestor::xs:element/@name='MSG'">
			<xsl:apply-templates select="key('elements', '')"
mode="start"/>
			<xsl:apply-templates select="key('elements', '')"
mode="end"/>
			<xsl:text>&#10;---11&#10;</xsl:text>
			<xsl:apply-templates
select="xs:element[starts-with(@ref, 'GRP')]"
mode="group"/>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>

==== end ====

__________________________________________________
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
  • Counting Child Nodes
    • bix xslt - Tue, 26 Nov 2002 17:34:01 -0500 (EST)
      • Jorge A. Salido - Tue, 26 Nov 2002 17:58:52 -0500 (EST)
      • Ritu - Tue, 26 Nov 2002 18:01:35 -0500 (EST)
      • Greg Faron - Tue, 26 Nov 2002 18:03:38 -0500 (EST)
        • Paul - Tue, 26 Nov 2002 20:32:09 -0500 (EST) <=
          • Paul - Thu, 28 Nov 2002 11:08:44 -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.