xsl-list
[Top] [All Lists]

Re: RE: xslt processing and style ant task

2004-07-16 00:07:10
[sorry for the cross post]

You may want to try using two tasks, xcluder [1] for XInclude and then xslt/style for XSLT. xcluder uses Xerces or XOM. Note that it's just a wrapper so the namespaces the task will understand and conformance in general depends on what is used under the hood. I had to download a CVS based version of Xerces to use the namespace of the 13 April CR.

[1] http://sourceforge.net/projects/xcluder

hth,

Manos



Nicolas Mailhot wrote:

Le jeu, 15/07/2004 à 09:14 -0500, Dominique Devienne a écrit :
From: Nicolas Mailhot [mailto:Nicolas(_dot_)Mailhot(_at_)laPoste(_dot_)net]

Hi all,

I currently need to process and xml document via ant's 1.5.4 style
task, using a 1.3.1 jvm and either xalan-j2 2.6.0 or saxon 6.5.3 as the
xslt engine.

A test run using libxslt's xsltproc shows the stylesheet actually does
what I want it to do. Unfortunately the style ant task seems totally
xinclude-ignorant. Is it possible to activate xinclude processing, maybe
using special processor values ? Else I'll just code a stylesheet to
merge the document since it's xinclude usage is simple and well-defined,
but doing custom processing on a standard extension feels plain wrong.
Which document uses XInclude, the source document, or the stylesheet?
I'd guess the source, since otherwise you'd use <xsl:include> in the
stylesheet, right!?

Right. That's the source document.

(In fact I have quite a few docs that were broken into pieces using
entities that are screaming for XInclude instead. The problem with
entities is you can't validate individual pieces separately since the
XML header and doctype declaration are only present in the master file)

I'm not interested in any solution that involves changing ant version
or installing ant extensions - a requirement of the setup is it must be
easily deployed, and introducing new binary requirements is likely to me
much heavier than coding a custom stylesheet.

Longer-term of course having ant style ignore xinclude by default
seems plain wrong.
It's not Xalan or Saxon that need to be XInclude-aware, but the XML parser
you are using. Just switch to using such a parser, by configuring the VM to
use this parser (using the standard JAXP way of doing such a thing).

The fact that Ant comes bundled with Xerces might get in the way though...

Well, I'm using xerces-j2 2.6.2 which is supposed to be fairly recent.

Or are you telling me the xerces people have no XInclude support nor are
planning for one ? Short-term I can work around this using the following
stylesheet (since I only need the most basic of XInclude support now)
but that means yet another bunch of intermediary files I have to track.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
               xmlns:xi="http://www.w3.org/2003/XInclude";
               version="1.0">
 <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
 <xsl:template match="*">
   <xsl:copy>
     <xsl:apply-templates select="@*"/>
     <xsl:apply-templates select="*"/>
   </xsl:copy>
 </xsl:template>
 <xsl:template match="@*">
   <xsl:copy/>
 </xsl:template>
 <xsl:template match="xi:include">
   <xsl:apply-templates select="document(@href)/*"/>
 </xsl:template>
</xsl:stylesheet>

Regards,




<Prev in Thread] Current Thread [Next in Thread>