garyp 01/04/02 03:24:18
Modified: java/src/org/apache/xalan/transformer TransformerImpl.java
Log:
Fix bugzilla bug 1170. If we're trying an xsl:apply-imports at the top level
(ie there are no
imported stylesheets), we need to indicate that there is no matching template
and prevent and infinite recursion by using the built-in template.
Revision Changes Path
1.91 +24 -10
xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java
Index: TransformerImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -r1.90 -r1.91
--- TransformerImpl.java 2001/03/28 04:41:04 1.90
+++ TransformerImpl.java 2001/04/02 10:24:17 1.91
@@ -2003,20 +2003,34 @@
maxImportLevel = -1;
}
- // Find the XSL template that is the best match for the
- // element.
- XPathContext xctxt = getXPathContext();
- PrefixResolver savedPrefixResolver = xctxt.getNamespaceContext();
+ // If we're trying an xsl:apply-imports at the top level (ie there are
no
+ // imported stylesheets), we need to indicate that there is no
matching template.
+ // The above logic will calculate a maxImportLevel of -1 which
indicates
+ // that we should find any template. This is because a value of -1 for
+ // maxImportLevel has a special meaning. But we don't want that.
+ // We want to match -no- templates. See bugzilla bug 1170.
- try
+ if (isApplyImports && (maxImportLevel == -1))
{
- xctxt.setNamespaceContext(xslInstruction);
- template = m_stylesheetRoot.getTemplateComposed(xctxt, child, mode,
maxImportLevel,
- m_quietConflictWarnings);
+ template = null;
}
- finally
+ else
{
- xctxt.setNamespaceContext(savedPrefixResolver);
+ // Find the XSL template that is the best match for the
+ // element.
+ XPathContext xctxt = getXPathContext();
+ PrefixResolver savedPrefixResolver = xctxt.getNamespaceContext();
+
+ try
+ {
+ xctxt.setNamespaceContext(xslInstruction);
+ template = m_stylesheetRoot.getTemplateComposed(xctxt, child,
mode, maxImportLevel,
+ m_quietConflictWarnings);
+ }
+ finally
+ {
+ xctxt.setNamespaceContext(savedPrefixResolver);
+ }
}
// If that didn't locate a node, fall back to a default template rule.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]