[ 
https://issues.apache.org/jira/browse/XALANJ-1451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16680021#comment-16680021
 ] 

Antonio Ospite commented on XALANJ-1451:
----------------------------------------

Related to https://issues.apache.org/jira/browse/XALANJ-645

If the {{<xsl:apply-templates/>}} before {{<xsl:attribute/>}} actually adds a 
elements, then the warning makes sense indeed.

However, in the particular example I added the {{<xsl:apply-templates/>}}  only 
adds attributes, so in this case the warning may be a false positive.

> getting warning Attribute is outside of element where a template precedes the 
> attribute
> ---------------------------------------------------------------------------------------
>
>                 Key: XALANJ-1451
>                 URL: https://issues.apache.org/jira/browse/XALANJ-1451
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in 
> Xalan projects.  Anybody can view the issue.) 
>          Components: XSLTC
>    Affects Versions: 2.5Dx
>         Environment: Operating System: Windows NT/2K
> Platform: PC
>            Reporter: Timothy E. Cronin
>
> 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.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to