This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

xslt assistance please


Hi,

Would someone help me get started with XSLT? I need to transform 1.xml to
2.xml.

Thanks a lot
Azariah

1.xml
--------

<root>

<AccountBaseDescriptorType>
  <element name="Name"       type="string"    minOccurs="0" />
  <element name="Medium"     type="string"    minOccurs="0" />
  <element name="Address"    type="string"    minOccurs="0" />
  <element name="Id"         type="Integer64" minOccurs="0" />
  <element name="remaining"  type="string"    minOccurs="0" />
</AccountBaseDescriptorType>

<AccountCreatableDescriptorType base="AccountBaseDescriptorType" >
  <mandatory>
    <Name/>
    <Address/>
  </mandatory>
  <prohibited>
    <Id/>
  </prohibited>
  <defaults>
    <Medium value="TW_MEDIUM_SMTP_HTTP"/>
  </defaults>
</AccountCreatableDescriptorType>

<AccountDescriptorType base="AccountBaseDescriptorType" >
  <mandatory fields="ALL">
  </mandatory>
</AccountDescriptorType>

</root>

2.xml
--------
<complexType name="AccountBaseDescriptorType">
  <all>
    <element name="Name"       type="string"    minOccurs=0 />
    <element name="Medium"     type="string"    minOccurs=0 />
    <element name="Address"    type="string"    minOccurs=0 />
    <element name="Id"         type="Integer64" minOccurs=0 />
    <element name="remaining"  type="string"    minOccurs=0 />
  </all>
</complexType>

<complexType name="AccountCreatableDescriptorType"
base="AccountBaseDescriptorType"
    derivedBy="restriction" >
  <all>
    <element name="Name"       type="string"    minOccurs=1 />
    <element name="Medium"     type="string"    use="default"
        value="TW_MEDIUM_SMTP_HTTP" />
    <element name="Address"    type="string"    minOccurs=1 />
    <element name="Id"         type="Integer64" minOccurs=0 maxOccurs=0 />
    <element name="remaining"  type="string"    minOccurs=0 />
  </all>
</complexType>

<complexType name="AccountDescriptorType" base="AccountBaseDescriptorType"
  derivedBy="restriction" >
  <all>
    <element name="Name"       type="string"    minOccurs=1 />
    <element name="Medium"     type="string"    minOccurs=1 />
    <element name="Address"    type="string"    minOccurs=1 />
    <element name="Id"         type="Integer64" minOccurs=1 />
    <element name="remaining"  type="string"    minOccurs=1 />
  </all>
</complexType>

PS1: My goal is to generate 2.xml. So, it is OK to restructure 1.xml to make
the transformation easier-to-write.
PS2: Performance is not a consideration for the transformation.
PS3: The element names "Account...DescriptorType" should not be hard-coded
in the .xsl file.



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]