You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2003/03/19 21:24:59 UTC

DO NOT REPLY [Bug 18162] New: - getting warning Attribute is outside of element where a template precedes the attribute

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=18162>.
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=18162

getting warning Attribute is outside of element where a template precedes the attribute

           Summary: getting warning Attribute is outside of element where a
                    template precedes the attribute
           Product: XalanJ2
           Version: 2.5Dx
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.xsltc
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: tim@13-colonies.com


given the following Stylesheet as a Source

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
  <FONT>
    <xsl:apply-templates select="/Properties/Group[@Name='Data 
Properties']/Datum[@Name='Font']/Font"/>
    <xsl:attribute name="color"><xsl:if test="Datum[@Name='QuantityShort']
&lt;0">Red</xsl:if></xsl:attribute>
    <xsl:value-of select="Datum[@Name='QuantityOnOrder']"/>
  </FONT>
  </xsl:template>
  <xsl:template match="Font">
    <xsl:attribute name="face"><xsl:value-of select="@Family"/></xsl:attribute>
    <xsl:attribute name="color"><xsl:value-of select="@Color"/></xsl:attribute>
    <xsl:attribute name="style">font-size:<xsl:value-of select="@Size"/>; font-
style:<xsl:value-of select="@Style"/>;font-weight:<xsl:value-of 
select="@Weight"/>;</xsl:attribute>
  </xsl:template>
</xsl:stylesheet>

I get a transformation warning saying that "Attribute color is outside of 
element" when calling
org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(Source source)

the error is refering to this line:
<xsl:attribute name="color"><xsl:if test="Datum[@Name='QuantityShort']
&lt;0">Red</xsl:if></xsl:attribute>

the problem is within the font section
  <FONT>
    <xsl:apply-templates select="/Properties/Group[@Name='Data 
Properties']/Datum[@Name='Font']/Font"/>
    <xsl:attribute name="color"><xsl:if test="Datum[@Name='QuantityShort']
&lt;0">Red</xsl:if></xsl:attribute>
    <xsl:value-of select="Datum[@Name='QuantityOnOrder']"/>
  </FONT>

the xsl:apply-templates is refering to <xsl:template match="Font"> that only 
sets font attributes.
the attribute after the template is also ignored.