Andreas Martens created XALANJ-2785:
---------------------------------------
Summary: xsltc doesn't restart namespace numbering on transform
Key: XALANJ-2785
URL: https://issues.apache.org/jira/browse/XALANJ-2785
Project: XalanJ2
Issue Type: Bug
Security Level: No security risk; visible to anyone (Ordinary problems in
Xalan projects. Anybody can view the issue.)
Components: XSLTC
Affects Versions: 2.7.3
Environment: xSeries Linux
Reporter: Andreas Martens
Attachments: TransformThread.java, foo0.xml, foo0.xsl
When running a transform that generates namespaces in the output, the xsltc
transformer creates new namespaces with a monotonically increasing unique
number.
I have modified the sample TransformerThread to illustrate the behaviour
If I take a stylesheet:
{{<?xml version="1.0" encoding="UTF-8"?>}}
{{<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:NS1="http://www.example.com/schema/wibble/1">}}
{{ <xsl:output omit-xml-declaration="yes" indent="yes"/>}}
{{ <xsl:strip-space elements="*"/>}}
{{ <xsl:template match="node() | @*">}}
{{ <xsl:copy>}}
{{ <xsl:apply-templates select="node() | @*"/>}}
{{ </xsl:copy>}}
{{ </xsl:template>}}
{{ <xsl:template match="*[ancestor-or-self::wobble]">}}
{{ <xsl:element name="\{name()}"
namespace="http://www.example.com/schema/wibble/1">}}
{{ <xsl:apply-templates select="node() | @*"/>}}
{{ </xsl:element>}}
{{ </xsl:template>}}
{{</xsl:stylesheet>}}
and apply it to xml:
{{<wobble><inner><event/></inner></wobble>}}
{{I get output:}}
{{<ns928753:wobble xmlns:ns928753="http://www.example.com/schema/wibble/1">}}
{{<ns928754:inner xmlns:ns928754="http://www.example.com/schema/wibble/1">}}
{{<ns928755:event xmlns:ns928755="http://www.example.com/schema/wibble/1"/>}}
{{</ns928754:inner>}}
{{</ns928753:wobble>}}
{{(it started at 0, I have simply run it a few more loops)}}
{{It's *technically* valid output, but it's particularly {_}nice{_}...}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]