[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Element - centric output
Hi, I have the following xml document and want element centric output. The input document is: <input "bunch of ns declarations..."> <attrs> <s:AttributeType name="CustomerID" /> <s:AttributeType name="CompanyName"/> <s:AttributeType name="ContactName"/> <s:AttributeType name="ContactTitle"/> </attrs> <data> <z:row CustomerID="ALFKI" ContactName="Maria Anders" ContactTitle="Sales Representative" /> <z:row CustomerID="ANATR" CompanyName="Ana Trujillo Emparedados y helados" ContactName="Ana Trujillo" ContactTitle="Owner" /> </data> </input> I want to output an element-centric XML from it. I also want to create leaf elements in the output if the attribute does not exist in the data/row but does exist as a required name in AttributeType/@name. For example, in the above XML, I would like the leaf element created for CompanyName for the first row. How can I acheive this? I already have the attribute to element translation working. I only need help for generating the leaf element if the attribute does not exist in the data set. Expected output: <RESPONSES> <RESPONSE> <CustomerID>ALFKI</CustomerID> <CompanyName/> <ContactName>Maria Anders</ContactName> <ContactTitle>Sales Representative</ContactTitle> </RESPONSE> <RESPONSE> <CustomerID>ANATR</CustomerID> <CompanyName>Ana Trujillo Emparedados y helados</CompanyName> <ContactName>Ana Trujillo</ContactName> <ContactTitle>Owner</ContactTitle> </RESPONSE> </RESPONSES> Thanks in advance for your help. Maulik XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|