[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: How to handle dynamic XPath

Subject: RE: How to handle dynamic XPath
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 14 Apr 2009 08:48:07 +0100
RE:  How to handle dynamic XPath
> I am using XSLT to walk through an XML Schema to construct an Xforms
> (output) instance.
> In parallel I am scanning an (input) instance (of a document 
> defined by the schema) to include default values in the form.
> 
> Scanning of the input instance is done by means of a variable 
> that keeps track of the path. The variable is updated 
> (renewed) each time a template is
> (recursively) called with the variable as parameter:

You haven't given a great deal of detail about the requirements

However, on the surface, I think my preferred approach here would be to
write a (meta)stylesheet that takes the schema as input and generates an
XSLT stylesheet as output. This latter stylesheet should then expand the
default values in your form.

This approach is more portable than using xx:evaluate(); it is also likely
to be more efficient, more resilient to namespace variations, and more
maintainable.

The other part of your application architecture I would question is the idea
of processing raw schema documents as your input. It's almost impossible in
practice to do this correctly - there are so many different ways that users
can write the same schema, and I bet that you end up testing your code on
only a tiny fraction of these. As an alternative, you might consider using
as input the SCM output available from the Saxon schema processor, which
gives you an XML view of the compiled schema, eliminating all these
variations.

Michael Kay
http://www.saxonica.com/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.