xsl-list
[Top] [All Lists]

Find attribute of node derived from extended base of ComplexType

2004-06-23 15:27:50
Hi,

I want to know wheter or not an ancester of a node has an attribute maxOccurs 
and the value of this attribute.

For nodes like the countries in the example below this is no problem with:

<xsl:when test="ancestor::*/@maxOccurs">
        <xsl:value-of select="ancestor::*/@maxOccurs"/>
</xsl:when>


I get the '3' of the node <xs:element name="ACountry" minOccurs="0" 
maxOccurs="3">.


The question now is:
How do I find the attribute and get the 'unbounded' value of the element:
        <xs:element name="AnEntry" type="AnEntryType" maxOccurs="unbounded"/>

when the current node is i.e: 
<xs:element name="ANumber"> of the extended base of the complexType 
"AnEntryType"?

Any Ideas? Your help is greatly appreciated!

Thanks and best regards,

Peter


'<!-- Example:
<xs:element name="AList">
        <xs:complexType>
            <xs:sequence>
            <xs:element name="AnEntry" type="AnEntryType" 
maxOccurs="unbounded"/>
                <xs:element name="OtherEntry" type="xs:string" minOccurs="0" 
maxOccurs="unbounded"/>
             </xs:sequence>
        </xs:complexType>
</xs:element>

<xs:complexType name="AnEntry">
        <xs:sequence>
                <xs:element name="AName" type="xs:string"/>             
                <xs:element name="ACountry" minOccurs="0" maxOccurs="3">
                        <xs:complexType>
                                <xs:sequence>
                                        <xs:element name="Europa" 
type="xs:string" minOccurs="0"/>
                                        <xs:element name="America" 
type="xs:string" minOccurs="0"/>
                                        <xs:element name="Asia" 
type="xs:string" minOccurs="0"/>
                                        <xs:element name="Africa" 
type="xs:string" minOccurs="0"/>
                                        <xs:element name="Australia" 
type="xs:string" minOccurs="0"/>
                                </xs:sequence>
                        </xs:complexType>
                </xs:element>
        </xs:sequence>
</xs:complexType>

<xs:complexType name="AnEntryType">
        <xs:complexContent>
                <xs:extension base="AnEntry">
                        <xs:sequence>
                                <xs:element name="ANumber">
                                        <xs:simpleType>
                                                <xs:restriction 
base="xs:positiveInteger">
                                                        <xs:minInclusive 
value="1"/>
                                                </xs:restriction>
                                        </xs:simpleType>
                                </xs:element>
                                <xs:element name="AMod" minOccurs="0">
                                        <xs:simpleType>
                                                <xs:restriction 
base="xs:decimal">
                                                        <xs:minInclusive 
value="0.5"/>
                                                        <xs:maxInclusive 
value="1.5"/>
                                                </xs:restriction>
                                        </xs:simpleType>
                                </xs:element>
                        </xs:sequence>
                </xs:extension>
        </xs:complexContent>
</xs:complexType>
End of example -->'

_____________________________________________________________________
Wenn Worte allein nicht ausreichen: WEB.DE Video-Mail - 
Die E-Mail der nachsten Generation! http://freemail.web.de/?mc=021197



<Prev in Thread] Current Thread [Next in Thread>