xsl-list
[Top] [All Lists]

not matching empty text nodes.

2003-02-05 18:03:18
This is obviously a newbie question.

Say I have

    <xsl:template match="/album/photos/photo/caption">
        <tr valign="top">
            <td class="label" align="right">caption:</td>
            <td class="caption"><xsl:value-of select="." /></td>
        </tr>
    </xsl:template>

My problem is that I _don't_ want to execute this template if there is no text content in the "caption" element.








Another question...

how do I provide a one-template solution to all elements which have the same requirements as caption?
For instance, there are more of these...

    <xsl:template match="/album/photos/photo/description">
        <tr valign="top">
            <td class="label" align="right">description:</td>
            <td class="caption"><xsl:value-of select="." /></td>
        </tr>
    </xsl:template>

    <xsl:template match="/album/photos/photo/location">
        <tr valign="top">
            <td class="label" align="right">location:</td>
            <td class="caption"><xsl:value-of select="." /></td>
        </tr>
    </xsl:template>


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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