Subject: Re: Modifying XML file using XSLT based on XSD
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Tue, 19 Jul 2005 00:39:56 -0700 (PDT)
|
There is no fixed technique for this.. It seems, as
per your requirement, the stylesheet will be quite
custom built. I suggest please don't use XSD at all
while writing XSLT.
Regards,
Mukul
--- Lakshmi narayana <lchintala@xxxxxxxxxxxx> wrote:
>
> Hi List,
>
> Is it possible to translate the xml file using xslt
> based on the XSD. For
> example, In my XSD file
> I specified the sequence of child nodes how they
> should appear in XML. It
> validates and raises
> error if they are not in specified sequence. Now I
> have to access that
> particular node and arrange the
> child nodes in the sequence specified in XSD file.
> Is it possible to do
> this. If possible can any one
> send me the xslt code to modify the source xml file
> using xslt based on XSD.
>
> Sample XML and XSD files
> XML file
> <Exception>
> <Type>X</Type>
> <Location><![CDATA[Right/Door
> Front]]></Location>
> <Description>Dings No Paint Damage,
> PDR</Description>
> <ChargeableFlag>0</ChargeableFlag>
> <PaintHours>0.0</PaintHours>
> <PartCost>50.0</PartCost>
> <RepairHours>0.0</RepairHours>
> <Total>50.0</Total>
> </Exception>
>
> XSD file
>
> <xs:schema elementFormDefault="qualified"
> attributeFormDefault="unqualified"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:element name="Exception">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Type" type="xs:string"/>
> <xs:element name="Description"
> type="xs:string"/>
> <xs:element name="ChargeableFlag"
> type="xs:boolean"/>
> <xs:element name="FrameHours" type="xs:decimal"
> minOccurs="0"/>
> <xs:element name="PaintHours" type="xs:decimal"
> minOccurs="0"/>
> <xs:element name="PartCost" type="xs:decimal"
> minOccurs="0"/>
> <xs:element name="MetalHours" type="xs:decimal"
> minOccurs="0"/>
> <xs:element name="RepairHours" type="xs:decimal"
> minOccurs="0"/>
> <xs:element name="Total" type="xs:decimal"/>
> <xs:element name="Location" type="xs:string"/>
> <xs:element name="ExceptionImage" minOccurs="0"
> maxOccurs="5">
> <xs:complexType>
> <xs:all>
> <xs:element name="FileName"
> type="xs:string"/>
> </xs:all>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> Thanks,
> Laxmi Narayana
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|