xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Check for text between two elements??


Subject: Re: [xsl] Check for text between two elements??
From: Josh Canfield <joshcanfield@xxxxxxxxx>
Date: Thu, 2 Sep 2004 16:11:04 -0700

You aren't testing if there is text between two tags, but rather
whether a text node is the first node following an element node.

In your case, if you want to output all of the nodes with no following
text node:

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet 
    version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>

<xsl:template match="/AAA">
  <no-text><xsl:copy-of
select="*[following-sibling::node()[1]/text()]"/></no-text>
</xsl:template>

</xsl:stylesheet>

The select statement says:
select every child element of the context node (AAA) that has a text
node as it's first following sibling.

Josh

On Thu, 02 Sep 2004 15:27:49 -0700, Sameer N <samooo_vc@xxxxxxxxxxx> wrote:
> I want to test if there is a text between two elements using XSLT.
> 
> I have some xml like this....
> <AAA>There is this text <BBB> more text </BBB> text continues <CCC> still
> more text </CCC> and back to text </AAA>
> or it can be like this
> <AAA>There is this text <BBB> more text </BBB><CCC>still more text</CCC> and
> back to text </AAA>
> 
> Now, I want to test whether there is text present between tags <BBB> and
> <CCC>. Is this possible using XSLT?
> 
> Thanks.
> 
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today - it's FREE!
> hthttp://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


Current Thread
Keywords
xml
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor