Subject: Re: [xsl] not matching empty text nodes. From: Terence <tk.lists@xxxxxxxxxxx> Date: Sun, 09 Feb 2003 13:41:30 +1100 |
TryThis works very well :-)
xsl:template match="/album/photos/photo/caption[text()!='']"
The only problem is, some of the non-empty text nodes are nothing but whitespace.
That's because all the text nodes I want to capture don't have any other sub-elements (ie. it's plain text, not markup).
I tried using <xsl:strip-space elements="*" /> but it seemed to have no effect on the sablotron processor.
This works a treat :-)
and
<xsl:template match="/album/photos/photo/*[text()!='']"> <tr valign="top"> <td class="label" align="right"><xsl:value-of select="name()"/>:</td> <td class="caption"><xsl:value-of select="." /></td> </tr> </xsl:template>
<xsl:template match="photo/*[text()!=''][count(*)=0]"> <tr valign="top"> <td class="label" align="right"><xsl:value-of select="name()"/>:</td> <td class="{name()}"><xsl:value-of select="." /></td> </tr> </xsl:template>
<xsl:template match="photo/*[@name!='']"> <tr valign="top"> <td class="label" align="right"><xsl:value-of select="name()"/>:</td> <td class="{name()}"><xsl:value-of select="@name" /></td> </tr> </xsl:template>
<xsl:template match="photo/*[@year!='']"> <tr valign="top"> <td class="label" align="right"><xsl:value-of select="name()"/>:</td> <td class="{name()}"> <xsl:value-of select="@day" />/<xsl:value-of select="@month" />/<xsl:value-of select="@year" /> - <xsl:value-of select="@hour" />:<xsl:value-of select="@min" /> </td> </tr> </xsl:template>
This has reduced the size of my sheet signifigantly and there is less modification in the event of a schema change.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] not matching empty text n, Ross Ken | Thread | Re: [xsl] not matching empty text n, Joerg Heinicke |
Re: [xsl] a quick question re: &nbs, Terence | Date | Re: [xsl] PHP included as a PI?, Terence |
Month |