[Home] [By Thread] [By Date] [Recent Entries]

  • To: "'XML'" <xml-dev@l...>
  • Subject: looking for existing XSL code
  • From: "Wo Chang" <wchang@n...>
  • Date: Wed, 27 Feb 2002 11:11:28 -0500
  • Reply-to: "Wo Chang" <wchang@n...>

** not sure how active is the XSL-LIST, so I'm posting here too, sorry! **

Dear XSLT experts,

Are there any existing XSLT code out there to walk thru the
schema tree and output the node number starting from the
root element?

Ex:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>

 <xs:element name="personnel">
  <xs:complexType>
   <xs:sequence>
     <xs:element ref="person" minOccurs='1' maxOccurs='unbounded'/>
   </xs:sequence>
  </xs:complexType>
 </xs:element>

 <xs:element name="person">
  <xs:complexType>
   <xs:sequence>
     <xs:element ref="name"/>
     <xs:element ref="email" minOccurs='0' maxOccurs='unbounded'/>
   </xs:sequence>
   <xs:attribute name="id"  type="xs:ID" use='required'/>
    <xs:simpleType>
     <xs:restriction base = "xs:string">
       <xs:enumeration value="true"/>
       <xs:enumeration value="false"/>
     </xs:restriction>
    </xs:simpleType>
   </xs:attribute>
   <xs:attribute name="salary" type="xs:integer"/>
  </xs:complexType>
 </xs:element>

 <xs:element name="name">
  <xs:complexType>
   <xs:all>
    <xs:element ref="family"/>
    <xs:element ref="given"/>
   </xs:all>
  </xs:complexType>
 </xs:element>

 <xs:element name="family" type='xs:string'/>
 <xs:element name="given" type='xs:string'/>
 <xs:element name="email" type='xs:string'/>

</xs:schema>

And my desire output would look something like:

1           personnel
1.1        person
1.1.1     name
1.1.1.1  family
1.1.1.2  given
1.1.2     email

Any pointers would be greatly appreciated!

--Wo




Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member