[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: document() revisited, final
Subject: RE: document() revisited, final From: "Beckers, Marc" <Marc.Beckers@xxxxxxxxxxxxxx> Date: Fri, 18 Feb 2000 12:35:59 +0100 |
I don't want to leave this topic without thanking you for all your help. What may seem straight-forward to you is not so obvious for non-programmers like myself. I have now a solution that works. FYI: A Perl script reads XHTML files into an XML file, something like: <mother> <file>files\overview.htm</file> <file>files\book1\page1.htm</file> <file>files\book1\chap1\page2.htm</file> </mother> The meat of my XSL: <!-- Get attributes --> <xsl:template name="copy.all.attrib"> <xsl:for-each select="@*"> <xsl:copy/> </xsl:for-each> </xsl:template> <!-- Define filter, copy results plus attributes --> <xsl:template name="filter"> <xsl:if test="not(boolean(@lang)) or ( @lang !='german' and @lang !='french' )"> <xsl:copy> <xsl:call-template name="copy.all.attrib"/> <xsl:apply-templates/> </xsl:copy> </xsl:if> </xsl:template> <!-- Identify old and new contents --> <xsl:template match="file"> <xsl:variable name="path" select="."/> <xsl:variable name="contents" select="document($path)"/> <xsl:variable name="newcontents"> <xsl:for-each select="$contents"> <xsl:apply-templates select="*"/> </xsl:for-each> </xsl:variable> <!-- "The name's Clark. James Clark." --> <xt:document method="html" href="{$path}"> <xsl:copy-of select="$newcontents"/> </xt:document> </xsl:template> <!-- Run the filter --> <xsl:template match="*"> <xsl:call-template name="filter"/> </xsl:template> This has great potential for our "legacy" HTML documentation (the "lang" and "dir" HTML attributes can be (ab)used for all sorts of things...) Thanks again, Marc XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: How to check if a File exist .., mohamed | Thread | Re: document() revisited, final, David Carlisle |
Re: attribute's value within href, Brendan McKenna | Date | RE: including an jpg-file, ergun . turker |
Month |