You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by William Flanders <fl...@denalisoft.com> on 2001/01/10 20:50:48 UTC

XalanJ 1.2.2 Bug of the Day

This is a bizarre bug in Xalan that really threw me for a loop.

I've reproduced it in both 1.1 and 1.2.  

Apparently, if you have a template that matches a "value" ELEMENT,
all of the "value" attributes' values get copied as children
even though the attributes are not elemements, and the template
is NEVER invoked.

This is a bug even if the output format is XML and not HTML.
I've worked around the bug with
match = "*[name() = 'value']"  but I'm curious about where
there is a special case for "value" elements which sets
some sort of odd flag in the processor.

Also, I've tried changing gabledygook/value to gabledygook/value1
and the behavior is replacated for "value1" attributes.

If this piques your curiosity:

% java org.apache.xalan.xslt.Process -in test.xml -xsl transform.xsl


test.xml
========

<?xml version="1.0" encoding="ISO-8859-1"?>

<html value = "html">
  <body value = "body"/>
  <applet>
    <param name = "param1" value1 = "paramval" />
  </applet>
</html>


transform.xsl:
=============

<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
                xmlns="http://www.w3.org/TR/REC-html40">

<xsl:output method="html" indent="yes"/>

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

<xsl:template match = "gabledygook/value">
  <pre>This template never gets invoked but
   causes a real mess</pre>
</xsl:template>
</xsl:stylesheet>



Result:
======


<html>html
  <body>body</body>
  <applet>
    <param name="param1" value1="paramval">
  </applet>
</html>