|
Subject: RE: [xsl] Node test--> text -->different format From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx> Date: Thu, 13 Nov 2003 20:51:39 +0100 |
> -----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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Node test--> text -->diff, Barry van Weldam | Thread | Re: [xsl] Node test--> text -->diff, Barry van Weldam |
| [xsl] Handling "IDL" Inheritence, Ram | Date | Re: [xsl] Outline a header, J.Pietschmann |
| Month |