I am trying to print a node that contains text and child nodes, but can't apply format to child nodes.
I have the following xml:
<text>Lorem Ipsum is simply dummy <link>text of the printing</link> and typesetting
industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s. </text>
I need to display the text in order and format the link. I also want to add a new line at the end of text.
Here is my xsl:
<xsl:template match="text">
<xsl:value-of select="."/>
<xsl:apply-templates select="link"/>
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="link">
<fo:basic-link color="red" text-decoration="underline" external-destination="{whatever}">
<xsl:value-of select="whatever"/>
</fo:basic-link>
</xsl:template>
With this code, i'm printing the links in place but not formated. Then at the end of the text all links are printed accordingly. Also the new line is not being printed.
Try
<xsl:template match="text">
<fo:block>
<xsl:apply-templates/>
<xsl:text> </xsl:text>
</fo:block>
</xsl:template>
<xsl:template match="link">
<fo:basic-link color="red" text-decoration="underline" external-destination="{whatever}">
<xsl:value-of select="whatever"/>
</fo:basic-link>
</xsl:template>