Jump to content
SpaceCowboy850

Using XSLT to extract nested complextypes into global types

Recommended Posts

I have a XSD that looks something like this:

 

<?xml version="1.0" encoding="utf-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.02">

<xs:include schemaLocation="Basic_Types.xsd"/>

<xs:element name="MyElement">

<xs:complexType mixed="true">

<xs:sequence>

<xs:element name="data">

<xs:complexType>

<xs:sequence>

<xs:element name="timeStamp" type="specialtime"/>

<xs:element name="DeviceClass">

<xs:complexType>

<xs:sequence>

<xs:element name="MaxAmount" type="Amount"/>

<xs:element name="MaxVolume" type="Volume"/>

</xs:sequence>

<xs:attribute name="Type" type="Type" use="required" fixed="FP"/>

<xs:attribute name="DeviceID" type="DeviceID" use="required"/>

</xs:complexType>

</xs:element>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:sequence>

<xs:attribute name="ApplicationSender" type="ApplicationSender" use="required"/>

<xs:attribute name="WorkstationID" type="WorkstationID" use="required"/>

</xs:complexType>

</xs:element>

</xs:schema>

 

I want to change it to look something like this:

 

<?xml version="1.0" encoding="utf-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.02">

<xs:include schemaLocation="Basic_Types.xsd"/>

 

<xs:complexType name="DeviceClass">

<xs:sequence>

<xs:element name="MaxAmount" type="Amount"/>

<xs:element name="MaxVolume" type="Volume"/>

</xs:sequence>

<xs:attribute name="Type" type="Type" use="required" fixed="FP"/>

<xs:attribute name="DeviceID" type="DeviceID" use="required"/>

</xs:complexType>

 

<xs:complexType name="data">

<xs:sequence>

<xs:element name="timeStamp" type="specialtime"/>

<xs:element name="DeviceClass" type ="DeviceClass"/>

</xs:sequence>

</xs:complexType>

 

<xs:complexType mixed ="true" name ="MyElement">

<xs:sequence>

<xs:element name="data" type ="data">

</xs:element>

</xs:sequence>

<xs:attribute name="ApplicationSender" type="ApplicationSender" use="required"/>

<xs:attribute name="WorkstationID" type="WorkstationID

Share this post


Link to post
Share on other sites

I'm guessing you can't just replace the one file.... What of xQuery? It's simple to learn and can do just about everything xslt 1.0 can and that was xQuery version 1.0. It being now version 3.0. It should be relatively easy.

Share this post


Link to post
Share on other sites

Yeah, if it was just 1 file, it wouldn't be a big deal. As it is it is over 100 files, that are all different. I hadn't heard of XQuery, I'll take a look at that.

Also check out xqib too. It's an alternative to JavaScript for handling the dom on server side scripting. Edited by L8V2L

Share this post


Link to post
Share on other sites

If I have been of help to you, do you think you could return the kindness, and seeing to answering any of my question in the xslt thread?

Edited by L8V2L

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...