match uncaught though declared in XSL

Here should go questions about transforming XML with XSLT and FOP.
Posts: 2
Joined: Wed Oct 23, 2013 9:07 am

match uncaught though declared in XSL

Post by sunnykeerthi » Thu Dec 04, 2014 4:44 pm

I've the below XML.

Code: Select all

<para indent="no">
<>18</> Further to same.
and when i run the below XSLT.

Code: Select all

<xsl:template match="para">

<xsl:value-of select="./node()[1][]|./label/node()[1][]"/>
<xsl:when test="./@align">
<xsl:attribute name="class"><xsl:text>para align-</xsl:text><xsl:value-of select="./@align"/></xsl:attribute>
<xsl:attribute name="class"><xsl:text>para</xsl:text></xsl:attribute>
When i run this, instead of printing <div class="para">18</div>, it is printing <div class="para"></div>

please let me know where am i going wrong and how can i fix this.

Thanks :( :(

Posts: 236
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany

Re: match uncaught though declared in XSL

Post by Patrik » Tue Feb 10, 2015 9:21 am


the code you posted only calls <xsl:apply-templates/> to deal with the content of the para element. So without any other templates the output would be

Code: Select all

<div class="para">
18 Further to same.
This is due to the default-templates that only output all the text content.

Since your output is different I can only assume that your script contains additional templates (for instance for which you didn't post!?

To get the ourput you described you could replace the <xsl:apply-templates/> with <xsl:value-of select=""/>.



Post Reply