forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J.Pietschmann" <j3322...@yahoo.de>
Subject Re: import of xml.apache.org main site into forrest
Date Wed, 05 Jun 2002 23:52:14 GMT
Bert Van Kets wrote:
> An alternative is
> 
> <xsl:template match"/">
>   <xsl:copy-of>
>     <xsl:value-of select="."/>
>   </xsl:copy-of>
> </xsl:template>
> 
> This copies the complete root node to the output incl. attributes and 
> children.

Hardly: too much syntax errors. Furthermore, the purpose of
the generic copy-through template, canonically expressed as
    <xsl:template match="node()|@*" priority="-1">
      <xsl:copy>
        <xsl:apply-templates select="node()|@*"/>
      </xsl:copy>
    </xsl:template>
(this version also copies all PI and comments),
is to allow other templates to "hook in". Xsl:copy-of copies
a whole subtree verbatim.
If you have
  <p>stuff <b>bold <link href="#anc">Bold Link Stuff</link></b></p>
then result of xsl:copy-of contains the <link> even if there is
a template matching <link>. With the copy-through template, the
template matching <link> is applied.

>> within document2html.xsl copies xhtml elements that are not explicitly 
>> handled in the document-v11.dtd. I've tried this and it works, e.g., 
>> for forms. Sorry for my probably naive question: how would you 
>> validate docs which contain such elements?

It depends on how strict the validation should be. If every HTML
element is declared as <!ELEMENT foo ANY> with proper attribut lists
in addition to the specific elements, also declared as ANY, the
validator will at least complain about unknown elements and attributes
but of course not about problems in the structure. A schema language,
properly aplied, perhaps in connection with namespaces, may perform
a more detailed validation.
The interesting question is: is it worth the trouble? A push style XSLT
should be able to cope even with gross structure problems, and a browser
will display basicaly all text.

J.Pietschmann


Mime
View raw message