This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: document() revisited
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: document() revisited
- From: Kay Michael <Michael dot Kay at icl dot com>
- Date: Wed, 16 Feb 2000 14:14:10 -0000
- Reply-To: xsl-list at mulberrytech dot com
You can do something like:
<xsl:template match="mother">
<xsl:for-each select="file">
<xsl:variable name="f" select="document(.)"/>
<saxon:output file="{.}">
<xsl:apply-templates select="f"/>
</saxon:output>
</xsl:for-each>
</xsl:template>
It will only overwrite the existing files if the "mother" document is in the
current directory, as document() interprets filenames relative to the
"mother" document, and saxon:output to the current directory. I wouldn't
recommend overwriting anyway, as the process then isn't restartable in the
event of a failure.
Obviously you can replace saxon:output by its equivalent in xt or Xalan. If
overwriting, take especial care with xt because it does lazy evaluation, I
don't think it writes the output before reading the input, but with James
you never know :-)
Mike Kay
> -----Original Message-----
> From: Beckers, Marc [mailto:Marc.Beckers@softwareag.com]
> Sent: 16 February 2000 10:49
> To: 'xsl-list@mulberrytech.com'
> Subject: document() revisited
>
>
> I've asked this before and got no replies,
> so I'll ask again and try and put the question more simply:
>
> I have an xml document containing a list of xhtml files, e.g.:
>
> <mother>
> <file>files\overview.html</file>
> <file>files\book1\page1.html</file>
> <file>files\book1\chap1\page2.html</file>
> <file>files\book2\page1.html</file>
> <file>files\book2\chap1\page2.html</file>
> </mother>
>
> How can I use XSL to enter each listed file,
> manipulate it and copy the result onto itself,
> thus retaining the file names and directory structure?
>
> Grateful for any tips or hints
>
> Dr. Marc Beckers
> Documentation Consultant
> Software AG
> Uhlandstraße 12
> D-64297 Darmstadt
> Phone +49-6151-92-1322
> Fax -1612
> mailto:Marc.Beckers@softwareag.com
> http://www.softwareag.com
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list