garyp 01/03/18 01:26:58
Modified: java/src/org/apache/xalan/processor StylesheetHandler.java
java/src/org/apache/xalan/templates ElemCallTemplate.java
ElemExtensionCall.java ElemLiteralResult.java
ElemTemplateElement.java OutputProperties.java
StylesheetRoot.java
Added: test/tests/contrib/garypeskin namespace47.out
namespace47.xml namespace47.xsl namespace47a.xsl
Log:
Fix bug 994 (http://nagoya.apache.org/bugzilla/show_bug.cgi?id=994) reported
by [EMAIL PROTECTED] (Jens Lautenbacher).
Stylesheets included via xsl:include or xsl:import were not honoring the
xsl:namespace-alias in an including/importing stylesheet.
The resolvePrefixTables() was being done as each stylesheet was at
endDocument so the compose() on the root had not yet been done.
The call to resolvePrefixTables() was moved to the compose() method on
ElemTemplateElement. In addition, resolvePrefixTables() no longer has to walk
the ElemTemplateElement tree because this is done by compose() already.
Revision Changes Path
1.38 +0 -4
xml-xalan/java/src/org/apache/xalan/processor/StylesheetHandler.java
Index: StylesheetHandler.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/StylesheetHandler.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- StylesheetHandler.java 2001/03/16 22:17:24 1.37
+++ StylesheetHandler.java 2001/03/18 09:26:57 1.38
@@ -494,10 +494,6 @@
{
if (0 == m_stylesheetLevel)
getStylesheetRoot().recompose();
-
- // Resolve the result prefix tables in the elements.
- if (null != getLastPoppedStylesheet())
- getLastPoppedStylesheet().resolvePrefixTables();
}
else
throw new TransformerException("Did not find the stylesheet root!");
1.17 +1 -1
xml-xalan/java/src/org/apache/xalan/templates/ElemCallTemplate.java
Index: ElemCallTemplate.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemCallTemplate.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- ElemCallTemplate.java 2001/02/13 20:28:56 1.16
+++ ElemCallTemplate.java 2001/03/18 09:26:57 1.17
@@ -149,7 +149,7 @@
* values that may be based on some other property that
* depends on recomposition.
*/
- public void compose()
+ public void compose() throws TransformerException
{
super.compose();
if ((null != m_templateName) && (null == m_template))
1.24 +2 -1
xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionCall.java
Index: ElemExtensionCall.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionCall.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- ElemExtensionCall.java 2001/01/29 19:51:02 1.23
+++ ElemExtensionCall.java 2001/03/18 09:26:57 1.24
@@ -140,9 +140,10 @@
* values that may be based on some other property that
* depends on recomposition.
*/
- public void compose()
+ public void compose() throws TransformerException
{
+ super.compose();
m_extns = this.getNamespace();
StylesheetRoot stylesheet = this.getStylesheetRoot();
1.24 +0 -102
xml-xalan/java/src/org/apache/xalan/templates/ElemLiteralResult.java
Index: ElemLiteralResult.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemLiteralResult.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- ElemLiteralResult.java 2001/03/06 05:50:22 1.23
+++ ElemLiteralResult.java 2001/03/18 09:26:57 1.24
@@ -575,108 +575,6 @@
return false;
}
-
- /*
- * Combine the parent's namespaces with this namespace
- * for fast processing, taking care to reference the
- * parent's namespace if this namespace adds nothing new.
- * (Recursive method, walking the elements depth-first,
- * processing parents before children).
- * Overide super method to handle exclude-result-prefix attribute.
- *
- * @throws TransformerException
- *
- public void resolvePrefixTables() throws TransformerException
- {
-
- // Always start with a fresh prefix table!
- m_prefixTable = null;
-
- Vector m_declaredPrefixes = getDeclaredPrefixes();
-
- // If we have declared declarations, then we look for
- // a parent that has namespace decls, and add them
- // to this element's decls. Otherwise we just point
- // to the parent that has decls.
- if (null != m_declaredPrefixes)
- {
-
- // Add this element's declared prefixes to the
- // prefix table.
- int n = m_declaredPrefixes.size();
-
- for (int i = 0; i < n; i++)
- {
- XMLNSDecl decl = (XMLNSDecl) m_declaredPrefixes.elementAt(i);
- String prefix = decl.getPrefix();
- String uri = decl.getURI();
- boolean shouldExclude = excludeResultNSDecl(prefix, uri);
-
- // Create a new prefix table if one has not already been created.
- if (null == m_prefixTable)
- m_prefixTable = new Vector();
-
- m_prefixTable.addElement(new XMLNSDecl(prefix, uri, shouldExclude));
- }
- }
-
- ElemTemplateElement parent = (ElemTemplateElement) this.getParentNode();
-
- if (null != parent)
- {
-
- // The prefix table of the parent should never be null!
- Vector prefixes = parent.m_prefixTable;
-
- if (null == m_excludeResultPrefixes && null == m_prefixTable)
- {
-
- // Nothing to combine, so just use parent's table!
- this.m_prefixTable = parent.m_prefixTable;
- }
- else
- {
- if (null == m_prefixTable)
- m_prefixTable = new Vector();
-
- // Add the prefixes from the parent's prefix table.
- int n = prefixes.size();
-
- for (int i = 0; i < n; i++)
- {
- XMLNSDecl decl = (XMLNSDecl) prefixes.elementAt(i);
- boolean isexcluded = decl.getIsExcluded();
-
- if (!isexcluded)
- {
- boolean shouldExclude = excludeResultNSDecl(decl.getPrefix(),
- decl.getURI());
-
- if (shouldExclude != isexcluded)
- {
- decl = new XMLNSDecl(decl.getPrefix(), decl.getURI(),
- shouldExclude);
- }
- }
-
- m_prefixTable.addElement(decl);
- }
- }
- }
- else if (null == m_prefixTable)
- {
-
- // Must be stylesheet element without any result prefixes!
- m_prefixTable = new Vector();
- }
-
- // Resolve the children's prefix tables.
- for (ElemTemplateElement child = m_firstChild; child != null;
- child = child.m_nextSibling)
- {
- child.resolvePrefixTables();
- }
- }*/
/**
* Copy a Literal Result Element into the Result tree, copy the
1.38 +4 -8
xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java
Index: ElemTemplateElement.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- ElemTemplateElement.java 2001/03/12 00:42:38 1.37
+++ ElemTemplateElement.java 2001/03/18 09:26:57 1.38
@@ -230,7 +230,10 @@
* values that may be based on some other property that
* depends on recomposition.
*/
- public void compose(){}
+ public void compose() throws TransformerException
+ {
+ resolvePrefixTables();
+ }
/**
* Validate that the string is an NCName.
@@ -923,13 +926,6 @@
// Must be stylesheet element without any result prefixes!
m_prefixTable = new Vector();
- }
-
- // Resolve the children's prefix tables.
- for (ElemTemplateElement child = m_firstChild; child != null;
- child = child.m_nextSibling)
- {
- child.resolvePrefixTables();
}
}
1.12 +2 -2
xml-xalan/java/src/org/apache/xalan/templates/OutputProperties.java
Index: OutputProperties.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/OutputProperties.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- OutputProperties.java 2001/03/05 19:54:53 1.11
+++ OutputProperties.java 2001/03/18 09:26:58 1.12
@@ -797,10 +797,10 @@
* values that may be based on some other property that
* depends on recomposition.
*/
- public void compose()
+ public void compose() throws TransformerException
{
- super.compose(); // just good form, not really needed.
+ super.compose();
m_propertiesLevels = null;
}
1.40 +1 -1
xml-xalan/java/src/org/apache/xalan/templates/StylesheetRoot.java
Index: StylesheetRoot.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/StylesheetRoot.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- StylesheetRoot.java 2001/03/12 00:42:38 1.39
+++ StylesheetRoot.java 2001/03/18 09:26:58 1.40
@@ -297,7 +297,7 @@
* the composed method called on it, and will have it's children's
composed
* methods called.
*/
- static void composeTemplates(ElemTemplateElement templ)
+ static void composeTemplates(ElemTemplateElement templ) throws
TransformerException
{
templ.compose();
1.1 xml-xalan/test/tests/contrib/garypeskin/namespace47.out
Index: namespace47.out
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<ixsl:stylesheet xmlns:ixsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<ixsl:template match="foo"><ixsl:text>Recognized
foo</ixsl:text></ixsl:template>
<ixsl:template match="bar"><ixsl:text>Recognized
bar</ixsl:text></ixsl:template>
</ixsl:stylesheet>
1.1 xml-xalan/test/tests/contrib/garypeskin/namespace47.xml
Index: namespace47.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<source>
<gen_a name="foo"/>
<gen_b name="bar"/>
</source>
1.1 xml-xalan/test/tests/contrib/garypeskin/namespace47.xsl
Index: namespace47.xsl
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:ixsl="http://www.w3.org/1999/XSL/TransformAlias"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- FileName: namespace47 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 7.1.1 Literal Result Elements -->
<!-- Creator: Gary L Peskin based on test case from Jens Lautenbacher -->
<!-- Purpose: Verify that namespace-alias is honored in included
stylesheets. -->
<xsl:include href="namespace47a.xsl"/>
<xsl:namespace-alias stylesheet-prefix="ixsl" result-prefix="xsl"/>
<xsl:template match="/">
<ixsl:stylesheet version="1.0">
<xsl:apply-templates/>
</ixsl:stylesheet>
</xsl:template>
<xsl:template match="gen_b">
<ixsl:template>
<xsl:attribute name="match"><xsl:value-of
select="@name"/></xsl:attribute>
<ixsl:text>Recognized <xsl:value-of select="@name"/></ixsl:text>
</ixsl:template>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/contrib/garypeskin/namespace47a.xsl
Index: namespace47a.xsl
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:ixsl="http://www.w3.org/1999/XSL/TransformAlias"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- FileName: namespace47a -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 7.1.1 Literal Result Elements -->
<!-- Creator: Gary L Peskin based on test case from Jens Lautenbacher -->
<!-- Purpose: Included stylesheet for test case namespace47. -->
<xsl:template match="gen_a">
<ixsl:template>
<xsl:attribute name="match"><xsl:value-of
select="@name"/></xsl:attribute>
<ixsl:text>Recognized <xsl:value-of select="@name"/></ixsl:text>
</ixsl:template>
</xsl:template>
</xsl:stylesheet>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]