xsl-list
[Top] [All Lists]

Re: [xsl] handling of xsl-Variable in formatting text

2016-04-15 08:30:10
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(_at_)saxonica(_dot_)com:
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
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>