This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: parse malformed XML element
- To: xsl-list at mulberrytech dot com
- Subject: Re: parse malformed XML element
- From: Wendell Piez <wapiez at mulberrytech dot com>
- Date: Thu, 24 Aug 2000 12:33:10 +0100
- Reply-To: xsl-list at mulberrytech dot com
Bertrand,
It's a bit of a puzzle what you want as output.
This will give you the literal output "text1 or text2 or text3 [... or
textN]":
<xsl:strip-space elements="p"/>
<xsl:template match="p">
<xsl:for-each select="text()">
<xsl:value-of select="normalize-space()"/>
<xsl:if test="position() < last()">
<xsl:text> or </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
You need that <xsl:strip-space> or the whitespace-only text nodes in your
source will mess up your count.
Is that what you wanted?
Cheers,
Wendell
At 04:30 PM 8/24/00 +0100, you wrote:
>I have the following XML:
>
><p> text1 <br/>
> text2 <br/>
> text3 <br/>
> .
> .
> .
><p/>
>
>I want get only the text1 or text2 or text3 or ...
>
>
>if i use <xsl:value-of select="p" /> i get text1+text2+text3+...
>if i use <xsl:value-of select="p/text()" /> i get only text1.
>
>How can i do ?
======================================================================
Wendell Piez mailto:wapiez@mulberrytech.com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list