You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Tim Cronin <ti...@13-colonies.com> on 2003/03/19 18:40:28 UTC

RE: xsl behavior

2.5D1

-----Original Message-----
From: Joseph Kesselman [mailto:keshlam@us.ibm.com]
Sent: Wednesday, March 19, 2003 11:36 AM
To: Tim Cronin
Subject: Re: xsl behavior

><xsl:attribute> must generate its output as the child of an element 
>(either literal result element or <xsl:element> and must precede any 
>non-attribute children.

it is the child of an element, the font template just generates attributes.

>Try generating the attribute _before_ calling <xsl:apply-templates>.

with the attrib before, the template always overrides it.

the attrib was below the template in order to override what the template set
depending
on the xsl:if.


-----Original Message-----
From: Voytenko, Dimitry [mailto:dvoytenko@reveredata.com]
Sent: Wednesday, March 19, 2003 11:45 AM
To: 'Tim Cronin'; xalan-j-users@xml.apache.org
Subject: RE: xsl behaviour


Hi Tim,

What's the version of Xalan you're using?

Thanks,
Dimitry

-----Original Message-----
From: Tim Cronin [mailto:tim@13-colonies.com]
Sent: Wednesday, March 19, 2003 08:29
To: xalan-j-users@xml.apache.org
Subject: xsl behaviour


given the following Stylesheet

<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"
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>

under MS this worked OK... 
should I be able to do this? 


_____________________________________________________
Revere Data, LLC, formerly known as Sector Data, LLC, is not affiliated with
Sector, Inc., or SIAC.