Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 15th, 2008, 02:06 PM
Registered User
 
Join Date: May 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML Schema translation w/ included schemas

Hello, new member here. I've searched the forum for questions related to this but haven't found much of use.
I have the unfortunate task of attempting to translate a large collection of XML Schema's to templates for further application processing. These schema's have several includes to other schema's (which in turn might include yet other schema's, with the unfortunate case of there being cyclic dependencies) and a sample primary schema might include up to 70 other schema's after all includes have been handled.
Since XML Schema's are themselves XML I figured XSLT's would be the natural way to go, especially since the template outputs are also pseudo-XML Schema's themselves, and certainly are XML-based. But it seems as though this might not be the case. The templates need to be one resulting document that contains transformed elements referenced by elements in the primary schema to secondary schema's.
ie
primary schema
Code:
<xs:include schemaLocation="datatypes.xsd" />
<xs:element name="foo" type="barDataType" />
secondary schema
Code:
<xs:complexType name="barDataType">
  ...
</xs:complexType>
with the result hopefully being something like:

Code:
<template>
  <complexType name="barDataType">
    ...
  </complexType>
  ...
  <element name="foo" type="barDataType" />
</template>
or possibly:
Code:
<template>
  <element name="foo">
    <complexType>
      ...(transformed barDataType in-lined)
    </complexType>
  </element>
</template>
Is this possible (with one level of dependancy? with multiple? with cyclic dependancies?) If so, do I need a schema-aware processor (if so, what would I need to do to accomplish this) or can I somehow store some list of all possible includes to look through when I encounter a non-local/non-base datatype (or xsl:copy-of, or some other method I haven't considered)? Namespace awareness isn't an issue, as all schema's don't use a namespace. Or should I forget XSLT's for this and write some program to create a temporary (and massively large) schema that contains all necessary types locally and translate that with my other transformations?

Thanks in advance for any assistance.

Grant

 
Old May 15th, 2008, 03:13 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Processing raw schema documents using XSLT or anything else is not an easy task, because there are so many different ways users can write effectively the same thing.

You might find it easier to start with an XML dump of a compiled schema, which you can get from Saxon (option -scmout on the com.saxonica.Validate command line) - this removes many of the syntactic variations and avoids the need to process multiple input documents.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old May 16th, 2008, 04:14 PM
Registered User
 
Join Date: May 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your reply.
I'm certainly not keen on the idea of translating all these schema's but unfortunately that's what I'm tasked to do so here I am.
One plus is the files are all generated and aren't hand-crafted and there doesn't seem to be any real complexity to the files themselves, just the dependencies.
I might have figured something out, but I might come back with more questions. Thanks.






Similar Threads
Thread Thread Starter Forum Replies Last Post
WordprocessingML 2 XML Translation ROCXY XSLT 3 July 11th, 2007 04:47 AM
XML Schemas - Fixed Values jock_sbfc XML 3 February 13th, 2007 07:45 AM
Using XML Schemas in C++ Unmanaged Code RFickling XML 1 June 8th, 2005 08:23 AM
Regular expressions in XML schemas adrianbarry XML 10 April 7th, 2004 07:54 AM
Source code of Professional XML Schemas Vivian All Other Wrox Books 0 February 2nd, 2004 12:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.