Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 3rd, 2010, 04:00 PM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Default handling multiple input xml feeds

I am building an end to end XML application that ingests different types of XML feeds and using Saxon for the transformation and XSD validation. Each feed has their own dedicated XSLT templates and XSDs, but do share a few common templates.

I am wondering if there is a way to have a primary XSLT template that will determine the feed type and only load the necessary stylesheets for that feed? Or do I need to make that determination before the transformation and keep each transformation pipeline separate?

I am trying to avoid loading unnecessary stylesheets.
Reply With Quote
  #2 (permalink)  
Old March 3rd, 2010, 05:28 PM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I just found this post on the www.dpawson.co.uk faq pages which
seems to address my question. I assume this logic still stands. So,
I will want to determine the feed type first, then apply the
feed specific stylesheets (that import any common modules), right?
I was hoping to keep this logic within the transformation process,
but it seems like I cannot.

From http://www.dpawson.co.uk/xsl/sect1/N169.html:

> It seems that there is no way to dynamically import or include another
> stylesheet, unless one writes the calling stylesheet at runtime.
Correct, xsl:include and xsl:import are compile-time facilities.
> More concretely, I am trying to create a sheet that uses a default
> stylesheet for a portion of an HTML document, but I want that
> portion to be able to be replaced by a user simply specifying
> an alternate stylesheet source in the source XML of the translation.
The desire for run-time xsl:import is voiced quite often, and for once it's nice to hear exactly why you want it, so that I can tell you why you don't!
Instead of A conditionally importing stylesheet B1, B2, or B3 each of which replaces part of A, the user should select stylesheet B1, B2, or B3, each of which imports the fixed stylesheet A and replaces or overrides parts of it. The special-case stylesheet should import the general-case stylesheet, not the other way around.
Reply With Quote
  #3 (permalink)  
Old March 3rd, 2010, 05:31 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

It depends a little bit what technology you are using to control the pipeline, e.g. whether it's something like XProc or Orbeon, or whether it's hand-coded Java; and if it's Java, what APIs to Saxon you are using.

Generally, I would suggest building the document as a Saxon tree, then inspecting it using XPath to determine the "feed type", then running the appropriate transformation using the already-built document. If you don't mind using Saxon-specific interfaces, I think you'll find s9api works well for this kind of application.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Reply With Quote
  #4 (permalink)  
Old March 3rd, 2010, 05:42 PM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for the guidance. We will likely be using Java, but I haven't looked into XProc or Orbeon, which I will now be doing shortly.
Reply With Quote
  #5 (permalink)  
Old March 3rd, 2010, 06:02 PM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Default xproc support in Saxon?

Does the latest release of Saxon support xproc?
Reply With Quote
  #6 (permalink)  
Old March 3rd, 2010, 06:21 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

No, but the latest XProc processors support Saxon ;-)

XProc is a fairly new kid on the block, the most mature processor is probably Calabash from Norm Walsh. Orbeon has been around much longer, and has many more tools, but currently supports its own pipeline language rather than XProc. It works with Saxon too.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple input xml / get data from other xml file elayaraja.s XSLT 3 July 25th, 2008 06:59 AM
XML/XSLT/RSS feeds goldnmunk XSLT 5 July 24th, 2007 05:21 AM
handling multiple record sets Phrozt Classic ASP Professional 1 October 12th, 2006 04:33 AM
beginners problems (combining xml feeds etc) bewise XSLT 0 February 7th, 2006 06:39 AM
xml and xsl templates as input to xslt gives xml rameshnarayan XSLT 5 August 3rd, 2005 01:58 AM



All times are GMT -4. The time now is 11:07 PM.


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