This is the mail archive of the mailing list .

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: document() revisited, final

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:


The meat of my XSL:

<!-- Get attributes -->   
 <xsl:template name="copy.all.attrib">
  <xsl:for-each select="@*">
 <!-- Define filter, copy results plus attributes --> 
 <xsl:template name="filter">
  <xsl:if test="not(boolean(@lang)) or ( @lang !='german' and @lang
!='french' )">
    <xsl:call-template name="copy.all.attrib"/>
 <!-- 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="*"/>
 <!-- "The name's Clark. James Clark." -->   
    <xt:document method="html" href="{$path}">
      <xsl:copy-of select="$newcontents"/>
 <!-- Run the filter --> 
  <xsl:template match="*">
    <xsl:call-template name="filter"/>

This has great potential for our "legacy" HTML documentation
(the "lang" and "dir" HTML attributes can be (ab)used for all sorts of
Thanks again,

 XSL-List info and archive:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]