DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20897>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20897

xsl:attribute and element extensions

           Summary: xsl:attribute and element extensions
           Product: XalanJ2
           Version: 2.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.templates
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Using extension elements inside of xsl:attribute produces error:
"javax.xml.transform.TransformerException: ns:name is not allowed in this 
position in the stylesheet!"

For instance, if I have describe prefix "my" as an extension element prefix, 
and there's element "url" in this namespace, call to
  <xsl:attribute name="HREF">
    <my:url>...</my:url>
  </xsl:attribute>
will produce error described above.

Extension usage such as this is particulary convinient for URL creation.
Workaround in this situation will be using temp variable:
  <xsl:variable name="href">
    <my:url>...</my:url>
  </xsl:variable>
  <xsl:attribute name="HREF">
    <xsl:value-of select="$href"/>
  </xsl:attribute>

As I understand, error is being raise during stylesheet parsing. Still, I 
couldn't find such a restriction anywhere in the XSLT 1.0 specification. 
Paragraph 7.1.3 of the spec only says that it's an error "Creating nodes other 
than text nodes during the instantiation of the content of the xsl:attribute 
element; implementations may either signal the error or ignore the offending 
nodes."
But I don't think this paragraph can be applied to this situation.
Otherwise, spec allows using "Content: template" inside of xsl:attribute and 
extension elements belong to this group.

Reply via email to