[ http://nagoya.apache.org/jira/browse/XALANJ-2011?page=history ]
     
Henry Zongaro resolved XALANJ-2011:
-----------------------------------

    Resolution: Invalid

XSLT 1.0 doesn't permit a namespace declaration to be created by an 
xsl:attribute instruction.  From Section 7.1.3 of that document[1]

  XSLT processors may make use of the prefix of the
  QName specified in the name attribute when
  selecting the prefix used for outputting the
  created attribute as XML; however, they are not
  required to do so and, if the prefix is xmlns, they
  must not do so. Thus, although it is not an error
  to do:

  <xsl:attribute name="xmlns:xsl" 
namespace="whatever">http://www.w3.org/1999/XSL/Transform</xsl:attribute>

  it will not result in a namespace declaration being
  output.

In your example, you should be able to use xsl:copy to copy namespace 
declarations, as in the following:

  <xsl:template match="/">
  <xsl:element name="newDocWithNamepaceOfOldDoc">
  <xsl:for-each select="//namespace::*">
  <xsl:copy/>
  </xsl:for-each>
  </xsl:element>
  </xsl:template>

I don't know whether you have other scenarios in which that technique is 
insufficient.

[1] http://www.w3.org/TR/xslt#creating-attributes

> xmlns not resolved
> ------------------
>
>          Key: XALANJ-2011
>          URL: http://nagoya.apache.org/jira/browse/XALANJ-2011
>      Project: XalanJ2
>         Type: Bug
>   Components: Xalan
>     Versions: 2.6
>  Environment: xalan-j-2_6_0 with xerces-2_6_2
>     Reporter: Roland Zorn

>
> Hi,
> see attached xls. I tried to create attribute with "namespace"-prefix xmlns. 
> This results in error: prefix xmlns can't be resolved. But it's also not 
> possible to use namespace-alias, cause defined by w3c ("The prefix xmlns is 
> used only for namespace bindings and is not itself bound to any namespace 
> name") xlmns has no URI.  So as xmlns is more a keyword than a prefix it must 
> be work without namespace checking. This is for special functionality of 
> xmlns and so I think a bug.
> Thanks Roland
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>       <xsl:output method="xml" 
>               version="1.0"
>               encoding="UTF-16" 
>               standalone="yes"
>               indent="yes" 
>       />
>               
>       <xsl:template match="/">
>               <xsl:element name="newDocWithNamepaceOfOldDoc">
>                       <xsl:for-each select="//namespace::*">
>                               <xsl:attribute 
> name="{concat('xmlns:',name())}"> 
>                                       <xsl:value-of select="." />
>                               </xsl:attribute> 
>                       </xsl:for-each>
>               </xsl:element>
>       </xsl:template>
> </xsl:stylesheet>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to