Home > other >  How to Add Line Break in XSLT to generate a PDF file
How to Add Line Break in XSLT to generate a PDF file

Time:11-04

I am using XSL FO (1.0) to generate a PDF file Below is the xml and xslt for that.. I want to add line break in xslt

XML

    <catalog>
    <cd value="First">
        <title company="Grammy" price="10.20">1999 Grammy Nominees</title>
        <artist all="type">Many</artist>
        <country>USA</country>
    </cd>
    </catalog>

XSLT

<xsl:template match="catalog/cd">
<fo:block>
    <xsl:value-of select="title " />
    <xsl:value-of select="artist" />
  <xsl:apply-templates/>
</fo:block>
</xsl:template>

Getting "1999 Grammy NomineesMany" as Output.How to add Line break to get the below output

1999 Grammy Nominees
Many

Thanks!!

CodePudding user response:

Either add <fo:block/> between the two xsl:value-of or put each xsl:value-of in a separate fo:block.

  • Related