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 February 1st, 2010, 03:25 PM
Authorized User
 
Join Date: Apr 2008
Posts: 11
Thanks: 5
Thanked 0 Times in 0 Posts
Default schema querying?

While I know that schema awareness allows for matching of sub-types, leverage of default values defined in XSD, and a bunch of other things, I've recently his a problem which I would think is possible to solve, but I have no idea as to how it would be done in XSL...

If I have an input element that has a bunch of attributes, say:

<GeneralObject class="foo" displayName="" ...>

And from this element, I'm interested in creating an output element, say:

<foo displayName="" ...>

However, I only want to add attributes that are valid for the given output type, and I cannot restrict (fix) my input content. Is there a way to do a schema look-up to see if an attribute is valid for a given element before attempting to generate output? (In my example, assume that the schema for the foo element does not define an attribute named 'displayName'.)

Thanks,
John

'Every time I paint a floor without getting stuck in a corner, they throw me in a room with more corners and fewer doors.'
 
Old February 2nd, 2010, 08:58 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

I have only limited experience with schema aware XSLT 2.0 but my current understanding is as follows:

With schema aware processing you could ask for validation of all or some of the nodes the stylesheet creates but I think the transformation fails if a node you asked to be validated is found not to be valid.

So that is all that is possible, you can ask for validation of the 'foo' result element the transformation creates and the transformation will either succeed if the element is found to be valid or the transformation will fail if the element is found to be invalid.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
The Following User Says Thank You to Martin Honnen For This Useful Post:
whelanj (February 2nd, 2010)
 
Old February 2nd, 2010, 07:12 PM
Authorized User
 
Join Date: Apr 2008
Posts: 11
Thanks: 5
Thanked 0 Times in 0 Posts
Default

I suppose that as a last-case option, I could attempt to generate an extension to XSL to perform a check. However, I'd much prefer to use standard functions.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Querying from 2 databases rajesh_css Oracle 3 November 18th, 2009 12:17 AM
Schema to Schema conversion onlyda XSLT 5 March 23rd, 2006 12:25 PM
Querying Recordset with a Loop rabu Access VBA 10 December 14th, 2005 04:49 PM
Querying .csv files aspiring_db_fundu Excel VBA 4 February 25th, 2004 01:01 PM





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