[xslV1]transform a character in newline

Here should go questions about transforming XML with XSLT and FOP.
Le Basque
Posts: 147
Joined: Sat Oct 19, 2013 8:21 am

[xslV1]transform a character in newline

Post by Le Basque »

hi,

I would like to translate the # newline

Code: Select all

<xsl:value-of select="translate('1#2#3#','#','&#xA;')"/>
I would like to get

Code: Select all


1
2
3
I obtains

Code: Select all

1 2 3 
Why ?

Thank you
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: [xslV1]transform a character in newline

Post by sorin_ristache »

Hello,

For the XSLT input:

Code: Select all

<xsl:value-of select="translate('1#2#3#','#','&#xA;')"/>
I get in the output:

Code: Select all


1
2
3
I run the XSLT transformation and I view the result in the Oxygen application. I get the same result if the result is saved by the XSLT transformation in a .txt or .xml file or if I just view the result in an Oxygen result view (the Show in results view option on the Output tab).

How do you view the result of the XSLT transformation? Does the transformation create an output file? What is the ASCII code (or Unicode code) of the character that separates the numbers 1, 2, 3?


Regards,
Sorin
Le Basque
Posts: 147
Joined: Sat Oct 19, 2013 8:21 am

Re: [xslV1]transform a character in newline

Post by Le Basque »

hi,

So we can not return to the line in a PDF generation?

thank you and happy New Year
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: [xslV1]transform a character in newline

Post by sorin_ristache »

Hello,

If you want to create PDF output and you need to force a new line for every character '#', you can extract the substrings separated by '#' (in your case the substrings are 1, 2 and 3) and place them in separate fo:block elements:

Code: Select all

  <fo:block>1</fo:block>
<fo:block>2</fo:block>
<fo:block>3</fo:block>

Regards,
Sorin
Post Reply