xsl-list
[Top] [All Lists]

Re: [xsl] where's here the error

2012-01-02 13:59:34
On 01/02/2012 11:17 AM, Matthieu Ricaud-Dussarget wrote:
<xsl:template match="section/entry">
<h2><value-of select="title" /></h2>
</xsl:template>
The problem with this generic solution is that if there is no title element (as this is the case for image/section/entry), you will get an empty h2 element.
You can add a test here or just deal with the first solution.

Use a predicate:

<xsl:template match="section/entry[boolean(title)]">
<h2><value-of select="title" /></h2>
</xsl:template>

0.02€

Regards
Graham


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>