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 November 15th, 2006, 12:43 PM
Registered User
 
Join Date: Aug 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default creating a subset of xml schema using XSLT

I am looking into an issue where we have a generic XML schema for a particular XML-EDI transaction.
In order to make this schema modular and maintainable we want to make many smaller XML schemas which will then be referred in the generic XML schema.

Then based on our clients requirements for this transaction, we would want to create a subset of this generic schema, so that the client specific schema is only specific to client XML document.

We would want to use XSLT to do that transformation.

My question here is would the generic XML schema import all the smaller schemas, so that resultant schema obtained has all the necessary schema elements as specified in stylesheet?


thanks

 
Old November 20th, 2006, 10:36 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

If I understand correctly, you want to include other schemas in your generic Schema through XSLT. You can use xs:include within your clients schema (http://www.w3schools.com/schema/el_include.asp) to include the Generic Schemas


 
Old November 20th, 2006, 12:51 PM
Registered User
 
Join Date: Aug 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That would be one way to do it.

Maybe I didn't explain my issue properly.

What I was thinking about was to have a generic schema(for a particular transaction) which referred to a number of smaller schemas.That is the generic schema kind of imports or includes the smaller schemas.

Now we have clients who would be interested in sending XML documents using only a part or a subset of the generic schema.

So what our plan is to to transform the generic schema using a style sheet(having rules specific to that client) to get a schema which is subset of generic schema.

This way we still retain generic schema(and all the smaller schemas which are included in the generic schema) and can create different schemas depending on clients requirement from the generic schema.

Would this be a good way to do it?

Thanks
Pankaj

 
Old November 20th, 2006, 01:42 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

"What I was thinking about was to have a generic schema(for a particular transaction) which referred to a number of smaller schemas.That is the generic schema kind of imports or includes the smaller schemas."

This would require your generic schema not to be generic anymore. However you can have your client schema's refer to your generic schema.

 
Old November 20th, 2006, 02:18 PM
Registered User
 
Join Date: Aug 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes I agree the generic schema won't be generic schema anymore as it would be a list of includes.

But i guess my question here is can this schema(having a list of includes in it) be transformed using XSLT to create a static XML schema?

thanks

 
Old November 20th, 2006, 05:46 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

I dont think you can use XSLT to transform an xsd into an xsd. A Schema is used to validate an XML file, an XSLT is used to transform an XML file to OUTPUT
 
Old November 20th, 2006, 06:45 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I'd be a bit reluctant to say unreservedly that this is a good idea. Firstly, I'm reluctant to endorse a design without more information on the requirements - and that makes it a consultancy exercise.

In principle yes, doing transformations on schemas can be a useful technique. But schemas are complex and there are all sorts of possible complications; I'm a little bit concerned that if you knew quite what you were taking on, you wouldn't be posting to this forum.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old November 21st, 2006, 09:41 AM
Registered User
 
Join Date: Aug 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Michael,
Thanks for your advice.
It should definitely help us.



 
Old November 21st, 2006, 09:46 AM
Registered User
 
Join Date: Aug 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Michael,
Why I was talking of this design was to know if it was a common practice to do transformations of schemas as schemas are XML documents themselves.

Thanks everyone for their advice.








Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating DB Table using XML inline schema info sriram_shol VB.NET 1 September 7th, 2012 01:08 PM
Extracting subset of XML using XSLT sentah XSLT 3 September 3rd, 2008 02:44 PM
Problem creating temp XML SCHEMA COLLECTION bijgupt SQL Server 2005 0 May 3rd, 2007 11:58 PM
Can XSLT read DTD/schema and Generate XSLT.. ROCXY XSLT 1 November 6th, 2006 09:39 AM
Creating an XML schema dynamically with C# dr_doom_77 C# 0 July 5th, 2003 11:27 AM





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