Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Text output twice. Once in HTML tags and immediately following html tags [Thread Next] Re: Text output twice. Once in HTML tags and immediately following html tagsTo: NULL Date: 3/4/2008 7:58:00 AM On Mar 3, 8:57 am, Martin Honnen <mahotr...@yahoo.de> wrote:
> koshin.mari...@gmail.com wrote:
> > <!-- This generates the Content section -->
> > <xsl:template match="Info_Log/*" mode="content" >
> > <xsl:element name ="h2">
> > <xsl:element name="a">
> > <xsl:attribute name="id">
> > <xsl:value-of select="name()"/>
> > </xsl:attribute>
> > <xsl:choose>
> > <xsl:when test="contains(name(),'_')">
> > <xsl:value-of select="substring-before(name(),'_')"/>
> > <xsl:text> </xsl:text>
> > <xsl:value-of select="substring-after(name(),'_')"/>
> > </xsl:when>
> > <xsl:otherwise>
> > <xsl:value-of select="name()"/>
> > </xsl:otherwise>
> > </xsl:choose>
> > </xsl:element>
> > </xsl:element>
>
> I haven't looked at all that code in detail but this could be the
> culprit, you first output text here, then
>
> > <xsl:if test="string-length(normalize-space(text()[1])) > 0">
> > <pre>
> > <xsl:value-of select ="text()"/>
> > </pre>
> > </xsl:if>
>
> here you process child nodes:
>
> > <xsl:apply-templates mode="content"/>
>
> That way it is possible that you output the text contained in a parent
> element, then later in a child element you output the same text or part
> of that text again.
>
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
Hi Martin,
Thanks for the response. I used <xsl:if test="string-
length(normalize-space(text()[1])) > 0"> to check if the current
node has text and the text length is > 0. I initially thought of
using the text() function but I realized that the text() function
alone but I realized that the text() function includes the text of
child elements as well which is not what I wanted. I only want to
examine if the current node has text and print the text between html
<pre> tags. I'll try your suggestions and see if that works.
Thanks,
Koshin
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
