This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Newbie: See if a node exists!
- From: Anand Kuppa <AnandK at transputec dot com>
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Date: Fri, 7 Jun 2002 12:08:43 +0100
- Subject: RE: [xsl] Newbie: See if a node exists!
- Reply-to: xsl-list at lists dot mulberrytech dot com
Try using COUNT
you could do something like
<xsl:when test = "if COUNT(BLOCK) > 0>
........what u want to do
</xsl:when>
lemme know if it worked...
cheers
-----Original Message-----
From: Américo Albuquerque (E-mail)
[mailto:aalbuquerque@viseu.ipiaget.pt]
Sent: Friday, June 07, 2002 11:51 AM
To: XSL-List (E-mail)
Subject: [xsl] Newbie: See if a node exists!
Hi!
I have two xml file
the first has this format
<Display>
<Path/>
<Title/>
<Book>
<Author/>
<Author/>
...
</Book>
<Book>
<Author/>
<Author/>
...
</Book>
...
</Display>
the second has a <Block> tag separating the <Book> tags like this
<Display>
...
<BLOCK>
<Book>
...
</Book>
...
</BLOCK>
...
</Display>
What i what is a way to see if a <Block> tag exists and, in that case, just
work with the <Book> inside the <Block>
if not then work with the <Book>
I use this xsl to do that but it doesn't do the Block Part
<xsl:choose>
<xsl:when test="./BLOCK">
<xsl:call-template name="Title"/>
<xsl:apply-templates select="BOOK"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="BookHeader"/>
<xsl:apply-templates select="BOOK[not (@destaque=-1)]"/>
</xsl:otherwise>
</xsl:choose>
What am I doing wrong?
Thanks in advance!
____________________________________________________________________________
____
() Chain Sword VROOOOMMMMM
___||_______________________ VROOOMMMM
(0___||______________________/ VROOOOMMMM
||~~~~~~~~~~~~~~~~~~~~~~
() "It cuts every thing
with a roar" www.geocities.com/Area51/6986
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list