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

Re: handling of xsl-Variable in formatting text

Subject: Re: handling of xsl-Variable in formatting text
From: "Dirk Naujoks naujoks@xxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Apr 2016 13:30:02 -0000
Re:  handling of xsl-Variable in formatting text
Thanks for your quick reply.

the problem with the source and the working document is that I am not to familiar with XSL and so I imagine I am not able to create such a document and the xml-source of the data contains personal data.

So maybe I try to explain the task i have to solve.

I want to format a block-objekt depending on a condition either 'bold' or 'normal'

My try was using the following code

<fo:block span="none" font-family="OfficinaSansLT" font-size="{$schrifta}" font-weight="{$outline}" text-align="start">

The variable "schrifta" can be set either to 20pt or what other value you like to and it is evaluated.

The variable "outline" i set according to my first post doesnt seem to be evaluated in this above code the text is allways "normal"

But if i use the code

<xsl:value-of disable-output-escaping="no" select="$outline" />

I get the right output either "bold" or "normal".

So I am a little mixed up. But I hope this description is clear enough to see what my problem is.

(because I am no nativ english-speaker it may be a little hard to find out what I mean)


Thanks for your Answers.



Am 15.04.2016 um 14:42 schrieb Michael Kay mike@xxxxxxxxxxxx:
It would help to give a complete executable stylesheet (preferably with irrelevant detail removed) and a source document, plus expected output, so people can run it for themselves and debug it for you. As it is, we can only stare at the code - you haven't even told us what the failure symptoms are ("it doesn't work" isn't very helpful...)

One thing I would suggest it to cut out the whitespace in the variable value, which at best is unnecessary and at worst could cause downstream processing to produce the wrong results:

           <xsl:choose>
                <xsl:when test="@pnr != '7000'">normal</xsl:when>
                <xsl:otherwise>bold</xsl:otherwise>
            </xsl:choose>

Not being able to see a source document, I don't know if it's relevant, but you should be aware of the exact meaning of "@pnr != '7000'" - it means "if the pnr attribute exists and has a value other than '7000'. Writing "not(@pnr = '7000')" has a different meaning when the attribute is absent.


Michael Kay
Saxonica

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.