Note that there are some explanatory texts on larger screens.

plurals
  1. POXSLT to alphabetize XML
    primarykey
    data
    text
    <p>I have about 10 xml schemas that I have to clean up by alphabetizing the elements/types. I googled for a while and found someone's solution,</p> <p><a href="http://blog.timothylux.com/2009/05/how-to-alphabetize-xml-elements-using.html" rel="nofollow noreferrer">Here</a></p> <p>which doesn't work for me for whatever reason (it skips from xsd:schema straight to xsd:comlplexType name=Account). Here is the simplist example, as you can see the first 10 or so elements are in order, but when the developer added 2 new fields they are out of order (crossRef and ID). I want to make sure that CrossRef and ID are alphabetized not only in the sequence when defined as part of the Account object, but also, if they were defined as their own types separately (these two fields aren't but the rest are) that their definitions would also be alphabetized with the rest of the definitions.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;xsd:schema targetNamespace="####" xmlns="####" xmlns:lms.base="####/base" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;xsd:import namespace="###/base" schemaLocation="Base.xsd" /&gt; &lt;xsd:element name="Account" type="Account" /&gt; &lt;xsd:complexType name="Account" &gt; &lt;xsd:complexContent &gt; &lt;xsd:extension base="lms.base:ExtensionBase"&gt; &lt;xsd:sequence &gt; &lt;xsd:element name="Address" type="lms.base:Address" minOccurs="0" maxOccurs ="unbounded" /&gt; &lt;xsd:element name="BusinessSegment" type="lms.base:BusinessSegment" minOccurs ="0" maxOccurs ="1" /&gt; &lt;xsd:element name="Name" type="AccountName" minOccurs ="0" maxOccurs ="1" /&gt; &lt;xsd:element name="Number" type="AccountNumber" minOccurs ="0" maxOccurs ="1" /&gt; &lt;xsd:element name="Office" type="AccountOffice" minOccurs ="0" maxOccurs ="1" /&gt; &lt;xsd:element name="Status" type="AccountStatus" minOccurs ="0" maxOccurs ="1" /&gt; &lt;xsd:element name="UWMemo" type="lms.base:UWMemo" minOccurs ="0" maxOccurs ="1" /&gt; &lt;xsd:element name="CrossRef" type="lms.base:string-minLength" minOccurs="0" maxOccurs="unbounded" /&gt; &lt;/xsd:sequence&gt; &lt;xsd:attribute name="ID" type="xsd:long" /&gt; &lt;/xsd:extension&gt; &lt;/xsd:complexContent&gt; &lt;/xsd:complexType&gt; &lt;xsd:simpleType name="AccountID"&gt; &lt;xsd:restriction base="lms.base:ID" /&gt; &lt;/xsd:simpleType&gt; &lt;xsd:simpleType name="AccountName"&gt; &lt;xsd:restriction base="lms.base:string-minLength" /&gt; &lt;/xsd:simpleType&gt; &lt;xsd:simpleType name="AccountNumber"&gt; &lt;xsd:restriction base="lms.base:string-minLength" /&gt; &lt;/xsd:simpleType&gt; &lt;xsd:simpleType name="AccountStatus"&gt; &lt;xsd:restriction base="lms.base:string-minLength"&gt; &lt;xsd:enumeration value="Not_Assigned" /&gt; &lt;xsd:enumeration value="Active" /&gt; &lt;xsd:enumeration value="Inactive" /&gt; &lt;xsd:enumeration value="Targeted/Prospect" /&gt; &lt;xsd:enumeration value="Lost" /&gt; &lt;xsd:enumeration value="Submission Declined" /&gt; &lt;xsd:enumeration value="Terminated" /&gt; &lt;xsd:enumeration value="Claim" /&gt; &lt;xsd:enumeration value="Watch List" /&gt; &lt;xsd:enumeration value="H.O. Hold/Suspend" /&gt; &lt;xsd:enumeration value="Infrequent" /&gt; &lt;/xsd:restriction&gt; &lt;/xsd:simpleType&gt; &lt;xsd:complexType name="AccountOffice"&gt; &lt;xsd:complexContent&gt; &lt;xsd:extension base="lms.base:Value"/&gt; &lt;/xsd:complexContent&gt; &lt;/xsd:complexType&gt; </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload