vgritsenko 02/03/22 19:45:32 Modified: src/java/org/apache/cocoon/components/language/markup/xsp/java xsp.xsl src/java/org/apache/cocoon/components/language/markup/xsp/javascript xsp.xsl Log: Fix bug with xsp:element: Namespace declared with uri and prefix attributes was not processed. Reported by: Leigh Dodds [[EMAIL PROTECTED]] Revision Changes Path 1.8 +28 -11 xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl Index: xsp.xsl =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- xsp.xsl 8 Mar 2002 04:08:53 -0000 1.7 +++ xsp.xsl 23 Mar 2002 03:45:32 -0000 1.8 @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<!-- $Id: xsp.xsl,v 1.7 2002/03/08 04:08:53 vgritsenko Exp $--> +<!-- $Id: xsp.xsl,v 1.8 2002/03/23 03:45:32 vgritsenko Exp $--> <!-- ============================================================================ @@ -57,7 +57,7 @@ * * @author <a href="mailto:[EMAIL PROTECTED]>Ricardo Rocha</a> * @author <a href="[EMAIL PROTECTED]">Sylvain Wallez</a> - * @version CVS $Revision: 1.7 $ $Date: 2002/03/08 04:08:53 $ + * @version CVS $Revision: 1.8 $ $Date: 2002/03/23 03:45:32 $ --> <xsl:stylesheet version="1.0" @@ -244,7 +244,7 @@ <xsl:copy-of select="$name"/> </xsl:when> <xsl:otherwise> - new StringBuffer(<xsl:copy-of select="$prefix"/>).append(":").append(<xsl:copy-of select="$name"/>).toString() + (<xsl:copy-of select="$prefix"/>)+":"+(<xsl:copy-of select="$name"/>) </xsl:otherwise> </xsl:choose> </xsl:variable> @@ -260,11 +260,23 @@ <xsl:if test="not($parent-element/namespace::*[local-name(.) = $ns-prefix and string(.) = $ns-uri])"> this.contentHandler.startPrefixMapping( "<xsl:value-of select="local-name(.)"/>", - "<xsl:value-of select="."/>" - ); + "<xsl:value-of select="."/>"); </xsl:if> + <xsl:for-each select="$parent-element/namespace::*[local-name(.) = $ns-prefix and string(.) = $ns-uri]"> + </xsl:for-each> </xsl:for-each> + <!-- Declare namespace defined by @uri and @prefix attribute --> + <xsl:if test="$uri != '""'"> + <xsl:if test="not($parent-element/namespace::*[local-name(.) = $prefix and string(.) = $uri])"> + this.contentHandler.startPrefixMapping( + <xsl:value-of select="$prefix"/>, + <xsl:value-of select="$uri"/>); + </xsl:if> + <xsl:for-each select="$parent-element/namespace::*[local-name(.) = $prefix and string(.) = $uri]"> + </xsl:for-each> + </xsl:if> + <xsl:apply-templates select="xsp:attribute | xsp:logic[xsp:attribute]"/> this.contentHandler.startElement( @@ -284,19 +296,24 @@ this.contentHandler.endElement( <xsl:copy-of select="$uri"/>, <xsl:copy-of select="$name"/>, - <xsl:copy-of select="$raw-name"/> - ); + <xsl:copy-of select="$raw-name"/>); + + <!-- Declare namespace defined by @uri and @prefix attribute --> + <xsl:if test="$uri != '""'"> + <xsl:if test="not($parent-element/namespace::*[local-name(.) = $prefix and string(.) = $uri])"> + this.contentHandler.endPrefixMapping(<xsl:value-of select="$prefix"/>); + </xsl:if> + <xsl:for-each select="$parent-element/namespace::*[local-name(.) = $prefix and string(.) = $uri]"> + </xsl:for-each> + </xsl:if> <xsl:for-each select="namespace::*"> <xsl:variable name="ns-prefix" select="local-name(.)"/> <xsl:variable name="ns-uri" select="string(.)"/> <xsl:if test="not($parent-element/namespace::*[local-name(.) = $ns-prefix and string(.) = $ns-uri])"> - this.contentHandler.endPrefixMapping( - "<xsl:value-of select="local-name(.)"/>" - ); + this.contentHandler.endPrefixMapping("<xsl:value-of select="local-name(.)"/>"); </xsl:if> </xsl:for-each> - </xsl:template> <xsl:template match="xsp:attribute"> 1.5 +21 -3 xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/javascript/xsp.xsl Index: xsp.xsl =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/javascript/xsp.xsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- xsp.xsl 8 Mar 2002 04:08:53 -0000 1.4 +++ xsp.xsl 23 Mar 2002 03:45:32 -0000 1.5 @@ -1,6 +1,6 @@ <?xml version="1.0"?> -<!-- $Id: xsp.xsl,v 1.4 2002/03/08 04:08:53 vgritsenko Exp $--> +<!-- $Id: xsp.xsl,v 1.5 2002/03/23 03:45:32 vgritsenko Exp $--> <!-- ***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * @@ -15,7 +15,7 @@ * XSP Core logicsheet for the JavaScript language * * @author <a href="mailto:[EMAIL PROTECTED]>Vadim Gritsenko</a> - * @version CVS $Revision: 1.4 $ $Date: 2002/03/08 04:08:53 $ + * @version CVS $Revision: 1.5 $ $Date: 2002/03/23 03:45:32 $ --> <xsl:stylesheet version="1.0" @@ -156,7 +156,7 @@ <xsl:copy-of select="$name"/> </xsl:when> <xsl:otherwise> - (<xsl:copy-of select="$prefix"/> + ":" + <xsl:copy-of select="$name"/>) + (<xsl:copy-of select="$prefix"/>)+":"+(<xsl:copy-of select="$name"/>) </xsl:otherwise> </xsl:choose> </xsl:variable> @@ -174,6 +174,15 @@ </xsl:if> </xsl:for-each> + <!-- Declare namespace defined by @uri and @prefix attribute --> + <xsl:if test="$uri != '""'"> + <xsl:if test="not($parent-element/namespace::*[local-name(.) = $prefix and string(.) = $uri])"> + contentHandler.startPrefixMapping(<xsl:value-of select="$prefix"/>, <xsl:value-of select="$uri"/>); + </xsl:if> + <xsl:for-each select="$parent-element/namespace::*[local-name(.) = $prefix and string(.) = $uri]"> + </xsl:for-each> + </xsl:if> + <xsl:apply-templates select="xsp:attribute | xsp:logic[xsp:attribute]"/> contentHandler.startElement(<xsl:copy-of select="$uri"/>, @@ -187,6 +196,15 @@ contentHandler.endElement(<xsl:copy-of select="$uri"/>, <xsl:copy-of select="$name"/>, <xsl:copy-of select="$raw-name"/>); + + <!-- Declare namespace defined by @uri and @prefix attribute --> + <xsl:if test="$uri != '""'"> + <xsl:if test="not($parent-element/namespace::*[local-name(.) = $prefix and string(.) = $uri])"> + contentHandler.endPrefixMapping(<xsl:value-of select="$prefix"/>); + </xsl:if> + <xsl:for-each select="$parent-element/namespace::*[local-name(.) = $prefix and string(.) = $uri]"> + </xsl:for-each> + </xsl:if> <xsl:for-each select="namespace::*"> <xsl:variable name="ns-prefix" select="local-name(.)"/>
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]