XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Conditionally formatting a HTML table row using XML/XSL

On 27/02/2022 12:38, Richard Watt wrote:
> Hi Matthias,
> 
> My apologies - that's me remembering the tags incorrectly: it's using
> <xsl:attribute name="class"> </xsl:attribute>, and the actual XSL reads as:
> 
>     <TR><xsl:if test="ORDERSTATUS='Completed'"> <xsl:attribute-value
>     name="class">trCompleted</xsl:attribute> </xsl:if>
> 
> Unfortunately, this doesn't work - the order details are always
> displayed in black regardless of the order status.

There is no such element type as xsl:attribute-value as far as I know.
It would be very useful for those of us who write documentation if you
could let us know where you found it.

What you need is

   <tr>
     <xsl:if test="ORDERSTATUS='Completed'">
       <xsl:attribute name="class">
         <xsl:text>trCompleted</text>
       </xsl:attribute>
     </xsl:if>
     ...whatever else...
   </tr>

I am assuming the <ORDERSTATUS> really is the name of an element type,
and not the name of an attribute, and that it is a child element of the
context in which this template is fired.

If you are repeating this structure for other values, consider making
the class value the value of ORDERSTATUS, eg

   <tr class="tr{ORDERSTATUS}">
     ...
   </tr>

Peter


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS