xsl-list
[Top] [All Lists]

RE: How many tags in one structure?

2005-07-19 11:07:50
Hi,

The following XPath expression will select all book elements containing
exactly 2 description elements (childs):

/bookshelf/book[count(description) = 2]

or

//book[count(description) = 2]

If you want more than 1 description (i.e., 2, 3, ...), then

/bookshelf/book[count(description) > 1]

I hope this helps.

Best regards,
Angel

-----Original Message-----
From: Karl Koch [mailto:TheRanger(_at_)gmx(_dot_)net]
Sent: 19 July 2005 20:00
To: Mulberry list
Subject: [xsl] How many tags in one structure?


Hello,

assuming I have the following structure (please take my applogies if the
books don't suit your taste ;-):

<bookshelf>
   <book>
     <id>1</id>
     <title>Alice in Wonderland</title>
     <description>A classic</description>
   </book>
    <book>
     <id>2</id>
     <title>1984</title>
     <description>A British Classic about a completely controlled society
written by George Orwell.</description>
     <description>Very good read</description>
   </book>
</bookshelf>

I wouild like to get those books, which do have two "description"
tags. How
can I do that? The results shouild look like that:

<bookshelf>
    <book>
     <id>2</id>
     <title>1984</title>
     <description>A British Classic ...</description>
     <description>Very good read</description>
   </book>
</bookshelf>

Kind Regards,
Karl

--
GMX DSL = Maximale Leistung zum minimalen Preis!
2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat:
http://www.gmx.net/de/go/dsl

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



______________________
Este mensaje, y en su caso, cualquier fichero anexo al mismo,
 puede contener informacion clasificada por su emisor como confidencial
 en el marco de su Sistema de Gestion de Seguridad de la 
Informacion siendo para uso exclusivo del destinatario, quedando 
prohibida su divulgacion copia o distribucion a terceros sin la 
autorizacion expresa del remitente. Si Vd. ha recibido este mensaje 
 erroneamente, se ruega lo notifique al remitente y proceda a su borrado. 
Gracias por su colaboracion.
______________________
This message including any attachments may contain confidential 
information, according to our Information Security Management System,
 and intended solely for a specific individual to whom they are addressed.
 Any unauthorised copy, disclosure or distribution of this message
 is strictly forbidden. If you have received this transmission in error,
 please notify the sender immediately and delete it.
______________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>