RE: [xsl] How many tags in one structure?

Subject: RE: [xsl] How many tags in one structure?
From: "Angel Gavin" <agavin@xxxxxx>
Date: Tue, 19 Jul 2005 20:11:13 +0200
Ooops!

In line with my previous email, to produce the output you want you can use
copy-of. For instance:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:template match="/">
		<bookshelf>
			<xsl:copy-of select="bookshelf/book[count(description) = 2]"/>
		</bookshelf>
	</xsl:template>
</xsl:stylesheet>

Regards,
Angel


> -----Original Message-----
> From: Angel Gavin [mailto:agavin@xxxxxx]
> Sent: 19 July 2005 20:08
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] How many tags in one structure?
>
>
> 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) &gt; 1]
>
> I hope this helps.
>
> Best regards,
> Angel
>
> > -----Original Message-----
> > From: Karl Koch [mailto:TheRanger@xxxxxxx]
> > 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
> >
>
>
> ______________________
> 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.
> ______________________
>


______________________
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.
______________________

Current Thread