[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Creating custom IDs using Parent name tree


Subject: Re: [xsl] Creating custom IDs using Parent name tree
From: "Wasiq Shaikh" <wasiq911@xxxxxxxxxxx>
Date: Tue, 24 Jul 2007 10:37:07 -0400

Thank you David for your suggestion, however, I should have been more clear on my example. The input file is actually an XSD, so ../@name wouldn't really work since the parent can be anything but <xsd:element>.

The other problem is that ../@name would give me only one parent name and not the ID of the parent. The ID of the parent doesn't exist and must be created (and stored ... somewhere?). Any element that needs to be processed needs to get the parent ID and concat its name to it.

The real problem is creating the ID, accessing that ID (which exists only in the resulting document), and appending the child elements name to it.

Input:

<xsd:element name="X">
     <xsd:complexType>
        <xsd:sequence>
              <xsd:element name="Y">
                 <xsd:complexType>
                    <xsd:sequence>
                       <xsd:element name="Z" type="ZType"/>
                    </xsd:sequence>
                 </xsd:complexType>
              </xsd:element>
              <xsd:element name="A" type="AType"/>
              <xsd:element name="Z">
                 <xsd:complexType>
                    <xsd:sequence>
                       <xsd:element name="Y">
                          <xsd:complexType>
                             <xsd:complexContent> ...

Should give:

<Elements>
 <element ID="X" name="X">
 <element ID="X.Y" name="Y">
 <element ID="X.Y.Z" name="Y">
 <element ID="X.A" name="A">
 <element ID="X.Z" name="Z">
 <element ID="X.Z.Y" name="Y">
</Elements>

So the element's ID depends on its parents ID which is only accessible in the resulting document. I hope this is more clear.

----Original Message Follows----

select="concat(PARENT_ID,'.',THIS_ELEMENTS_NAME)"/>
               ../@name            @name

David

_________________________________________________________________
Put Your Face In Your Space with Windows Live Spaces http://spaces.live.com/?mkt=en-ca



Current Thread
Keywords
xsd