match uncaught though declared in XSL
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 3
- Joined: Wed Oct 23, 2013 9:07 am
match uncaught though declared in XSL
Post by sunnykeerthi »
I've the below XML.
and when i run the below XSLT.
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

Code: Select all
<para indent="no">
<star.page>18</star.page> Further to same.
</para>
Code: Select all
<xsl:template match="para">
<xsl:value-of select="./node()[1][self::star.page]|./label/node()[1][self::star.page]"/>
<div>
<xsl:choose>
<xsl:when test="./@align">
<xsl:attribute name="class"><xsl:text>para align-</xsl:text><xsl:value-of select="./@align"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class"><xsl:text>para</xsl:text></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates/>
</div>
</xsl:template>
please let me know where am i going wrong and how can i fix this.
Thanks


-
- Posts: 280
- Joined: Thu Nov 28, 2013 9:32 am
- Location: Hamburg/Germany
- Contact:
Re: match uncaught though declared in XSL
Hi,
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
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 star.page) which you didn't post!?
To get the ourput you described you could replace the <xsl:apply-templates/> with <xsl:value-of select="star.page"/>.
regards
Patrik
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.
</div>
Since your output is different I can only assume that your script contains additional templates (for instance for star.page) which you didn't post!?
To get the ourput you described you could replace the <xsl:apply-templates/> with <xsl:value-of select="star.page"/>.
regards
Patrik
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service