[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Node test--> text -->different format
> -----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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|