Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Text output twice. Once in HTML tags and immediately following html tags

From: "koshin.mariano@-----.---" <------.-------@-----.--->
To: 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])) &gt; 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])) &gt; 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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent