[xsl] RE: xslt processing and style ant task

Subject: [xsl] RE: xslt processing and style ant task
From: Nicolas Mailhot <Nicolas.Mailhot@xxxxxxxxxxx>
Date: Thu, 15 Jul 2004 16:46:43 +0200
Le jeu, 15/07/2004 C  09:14 -0500, Dominique Devienne a C)crit :
> > From: Nicolas Mailhot [mailto:Nicolas.Mailhot@xxxxxxxxxxx]
> > 
> > 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";
  <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
  <xsl:template match="*">
      <xsl:apply-templates select="@*"/>
      <xsl:apply-templates select="*"/>
  <xsl:template match="@*">
  <xsl:template match="xi:include">
    <xsl:apply-templates select="document(@href)/*"/>


Nicolas Mailhot

Current Thread