|
I overrode the default template for matching
element nodes with this:
<xsl:template match="*">
<xsl:copy-of
match="."/>
</xsl:template>
This effectively copies all content, elements, etc.
of any elements I haven't created a template for. However, this
incorrectly match processing instructions like <?xml-stylesheet ... ?>,
for example. Processing instructions should only be matched by a
match="processing-instruction()" expression.
I am using Sablotron and XML-Sablotron 0.52.
Here are my xml and xsl files and the output from sabcmd:
#### example.xml ####
<?xml version="1.0"?>
<?xml-stylesheet href="example.xsl"
type="text/xsl"?>
<document>
<paragraph>Here is a
paragraph</paragraph>
</document>
#### example.xsl ####
<?xml version="1.0"?>
<xsl:output method="xhtml"/>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template
match="*">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
#### Output of "sabcmd example.xsl example.xml"
####
<?xml-stylesheet href="example.xsl"
type="text/xsl"?><document>
<paragraph>Here is a paragraph</paragraph> </document> You can see that the <?xml-stylesheet ... ?>
processing instruction is output, but it shouldn't be. This can cause
problems when my XSLT output HTML to a browser.
--
Trevor Leffler, Software Developer
PETTT / Ed-Tech Development Group University of Washington (206) 616-3406 / OUGL 230, Box 353080 |
