Subject: RE: Identity transform of stylesheet
From: "Andrew Welch" <AWelch@xxxxxxxxxxxxxxx>
Date: Tue, 8 Apr 2003 09:47:54 +0100
|
> If you want to apply the same transformation to the above document and
> to all the documents referenced (recursively) by xsl:include and
> xsl:import elements you can do:
Thanks Mike, I will have a look at this.
cheers
andrew
> -----Original Message-----
> From: Michael Kay [mailto:mhk@xxxxxxxxx]
> Sent: 07 April 2003 19:18
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: Identity transform of stylesheet
>
>
> > I need to perform an identity transform on a stylesheet to
> > add an attribute to each and every LRE. The stylesheet(s)
> > are of the form:
> >
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> > <xsl:include href="foo.xsl"/>
> > <xsl:template match="/">
> > <xsl:apply-templates/>
> > </xsl:template>
> > </xsl:stylesheet>
> >
> > The issue is performing the transform after all of the
> > includes/imports of the xsl have been processed, rather that
> > just the 6 line xml document.
>
> If the above is your source document, then it is just data,
> so there is
> no sense in which any xsl:include and xsl:import elements are going to
> be "processed, other than being processed in the same way as any other
> element in the source document.
>
> If you want to apply the same transformation to the above document and
> to all the documents referenced (recursively) by xsl:include and
> xsl:import elements you can do:
>
> <xsl:template match="xsl:stylesheet | xsl:transform">
> <xsl:apply-templates select="." mode="add-attributes"/>
> <xsl:for-each select="document(xsl:include/@href |
> xsl:import/@href)">
> <xxx:result-document href=".">
> <xsl:apply-templates select="*"/>
> </xxx:result-document>
> </xsl:for-each>
> </xsl:template>
>
>
> Where xxx:result-document is an extension element provided by your
> processor to produce multiple output files.
>
> Michael Kay
> Software AG
> home: Michael.H.Kay@xxxxxxxxxxxx
> work: Michael.Kay@xxxxxxxxxxxxxx
>
> > Ideally, I would
> > like to be able to take the transformer object and process
> > that as xml... as that would be the entire stylesheet, but of
> > course Im more than likely talking rubbish here :)
>
> Yes, there's no way you can reverse compile a transformer object to
> produce XML.
>
> Michael Kay
> Software AG
> home: Michael.H.Kay@xxxxxxxxxxxx
> work: Michael.Kay@xxxxxxxxxxxxxx
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
>
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.467 / Virus Database: 266 - Release Date: 01/04/2003
>
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.467 / Virus Database: 266 - Release Date: 01/04/2003
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|