hi guys, need some advice on processing child nodes
suppose i've a xml that looks like the below
....
<section>
<caption>section name</caption>
<content>some data</content>
</section>
<section>
<caption>section name</caption>
<content>
<media>....</media>
</content>
</section>
....
to transform the section, i have the following xsl
<xsl:template match="caption|content">
<xsl:for-each select="child::*" >
<xsl:if test="self::">
<xsl:value-of select="." />
</xsl:if>
<xsl:if test="self::media">
<xsl:call-template name="media" />
</xsl:if>
</xsl:for-each>
</xsl:template>
i'm having problems with the bold line. it is meant to display the caption or content if there is no child node to it..but dunno what to put in.
can anyone advise?
suppose i've a xml that looks like the below
....
<section>
<caption>section name</caption>
<content>some data</content>
</section>
<section>
<caption>section name</caption>
<content>
<media>....</media>
</content>
</section>
....
to transform the section, i have the following xsl
<xsl:template match="caption|content">
<xsl:for-each select="child::*" >
<xsl:if test="self::">
<xsl:value-of select="." />
</xsl:if>
<xsl:if test="self::media">
<xsl:call-template name="media" />
</xsl:if>
</xsl:for-each>
</xsl:template>
i'm having problems with the bold line. it is meant to display the caption or content if there is no child node to it..but dunno what to put in.
can anyone advise?