Hi
sorry for long code
I recap the code as a very "shortest" one that I can.
my problem is that I have to use the fact of
/xs:element/xs:complexType/xs:sequence/xs:element[(_at_)maxOccurs='unbounded']
instead of sth like starts-with(@ref, 'GRP')
I tried the amendment in the comment lines, but seems
there's still sth wrong, but I can see it.
is there any suggestion ?
thanks
===== schema =====
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="GRP-Harry-GROUP">
<xs:complexType>
<xs:sequence>
<xs:element ref="Harry-GROUP-ROW"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="SCSMSG">
<xs:complexType>
<xs:sequence>
<xs:element ref="GRP-Harry-GROUP"/>
<xs:element ref="snoopy-a"/>
<xs:element ref="snoopy-b"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
===== xsl =====
<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="byGRP"
match="xs:element[not(starts-with(@ref, 'GRP'))]"
use="generate-id(preceding::xs:element[starts-with(@ref,
'GRP')][1])"/>
<!--xsl:key name="byGRP"
match="xs:element[(_at_)ref !=
//xs:element/@name[boolean(descendant::xs:complexType/xs:sequence/xs:element/@maxOccurs)]]"
use="generate-id(preceding::xs:element/@name[boolean(descendant::xs:complexType/xs:sequence/xs:element/@maxOccurs)][1])"/-->
<xsl:template match="xs:sequence">
<xsl:variable name="first">
<xsl:value-of select="*[1]/@ref |
*[1]//xs:element[1]/@ref"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="starts-with($first,'GRP')">
<!--xsl:when
test="boolean(//xs:element/xs:complexType[../@name=$first])"-->
<xsl:for-each select="//xs:element[starts-with(@ref,
'GRP')]">
<!--xsl:for-each
select="//xs:element[boolean(//xs:element/xs:complexType[(_dot_)(_dot_)(_at_)name=@ref])]"-->
<xsl:variable name="me" select="generate-id()"/>
<xsl:text> Group is </xsl:text><xsl:value-of
select="@ref"/> :
<xsl:for-each select="key('byGRP',$me)">
<xsl:value-of select="@ref"/> Starts
</xsl:for-each>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
__________________________________________________
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