[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Node test--> text -->different format

Subject: RE: Node test--> text -->different format
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Thu, 13 Nov 2003 20:51:39 +0100
xsl node test
> -----Original Message-----
> From: Barry van Weldam
>
> [quote]
> using square brackets where none are needed
> [/quote]
> Hmm, indeed <xsl:when test="Row/Column_01!='Total'"> is better, right?


Yup!

<xsl:template match="Row/*">
  <xsl:choose>
    <xsl:when test="Row/Column_01 != 'Total'>

is the right way, *but*...

This will fail, because I believe your XML Row Element does not have child
nodes that have Row children... (just a guess) The above code would, for
every child node of a Row element, test whether its child(ren) --if any -
'Row/Column_01' equal the 'Total' string...

It would work for an XML that is structured like this:

<root>
  <Row>
    <SomeElement>
      <Row>
        <Column_01>Total</Column_01>
      </Row>
    </SomeElement>
  </Row>
</root>

However, I think yours looks like:

<root>
  <Row>
    <Column_01>Total</Column_01>
    <Column_02>...</Column_02>
    ...
  </Row>
</root>

So better to replace the template by:

<xsl:template match="Row">
  <xsl:choose>
    <xsl:when test="Column_01 = 'Total'">
      <!-- 'Row' is the current node, so you're actually testing
           for a possible 'Row/Column_01' element here -->
      <!-- bold formatting -->
    </xsl:when>
    <xsl:otherwise>
      <!-- normal formatting -->
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

Other suggestions? I think you can also solve it this way (a bit more
compact):

<xsl:template match="Row">
  ...
    <fo:block>
	<xsl:if test="Column_01 = 'Total'>
        <xsl:attribute name="font-weight">bold</xsl:attribute>
      </xsl:if>
      <!-- content here -->
    </fo:block>
 ...
</xsl:template>

In the latter solution, you only need to describe the fo:block once, and add
the boldface if and only if the Column_01 element in the Row being processed
equals the 'Total' string.


Cheerz,

Andreas


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.