[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: apply template

Subject: RE: apply template
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 24 Aug 2004 14:53:21 +0100
apply template
apply-templates by default selects the children of the context node, not the
context node itself. So change

	<xsl:for-each select="myns:Blog/myns:Entry">
		<xsl:apply-templates/>
	</xsl:for-each>

to

      <xsl:apply-templates select="myns:Blog/myns:Entry">

Michael Kay

> -----Original Message-----
> From: Jan Limpens [mailto:jan.limpens@xxxxxxxxx]
> Sent: 24 August 2004 14:41
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  apply template
>
> hi,
>
> I have another question, I hope someone will help me out, it's still
> beginner's stuff...
>
> the xml
> <?xml version="1.0" encoding="utf-8" ?>
> <Blog xmlns="http://tempuri.org/Blog.xsd">
> 	<Entry>
> 		<PubDate>10/10/2004</PubDate>
> 		<Category domain="Limpens.com">Test</Category>
> 		<Version lang="de">
> 			<Guid isPermaLink="true">111</Guid>
> 			<Title>Ich bin ein Eintrag</Title>
> 			<Description>Und eine Beschreibung</Description>
> 			<Link>Page.aspx</Link>
> 			<Image>Picture.gif</Image>
> 		</Version>
> 		<Version lang="pt">
> 			<Guid isPermaLink="true">111</Guid>
> 			<Title>Aqui sou eu!</Title>
> 			<Description>Uma descrigco</Description>
> 			<Link>Pagina.aspx</Link>
> 			<Image>Imagen.gif</Image>
> 		</Version>
> 	</Entry>
> 	<Entry>
> 		<PubDate>10/11/2004</PubDate>
> 		<Category domain="Limpens.com">Test</Category>
> 		<Version lang="de">
> 			<Guid isPermaLink="true">111</Guid>
> 			<Title>Ich bin auch ein Eintrag</Title>
> 			<Description>Und eine andere
> Beschreibung</Description>
> 			<Link>Page1.aspx</Link>
> 			<Image>Picture1.gif</Image>
> 		</Version>
> 		<Version lang="pt">
> 			<Guid isPermaLink="true">111</Guid>
> 			<Title>Aqui sou eu, tambem!</Title>
> 			<Description>Uma outra descrigco</Description>
> 			<Link>Pagina1.aspx</Link>
> 			<Image>Imagem1.gif</Image>
> 		</Version>
> 	</Entry>
> </Blog>
>
> the xsl
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsl:stylesheet version="1.0"
>                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                 xmlns:myns="http://tempuri.org/Blog.xsd"
>                 >
> 	<xsl:template match="/">
> 		<div class="Blog">
> 			<xsl:for-each select="myns:Blog/myns:Entry">
> 				<xsl:apply-templates/>
> 			</xsl:for-each>
> 		</div>
> 	</xsl:template>
> 	<xsl:template match="myns:Entry">
> 		<div class="Entry">
> 			<div>
> 				<xsl:value-of select="myns:PubDate" />
> 			</div>
> 		</div>
> 	</xsl:template>
> </xsl:stylesheet>
>
> produces
> <?xml version="1.0" encoding="UTF-16"?><div class="Blog"
> xmlns:myns="http://tempuri.org/Blog.xsd">10/10/2004Test111Ich bin ein
> EintragUnd eine BeschreibungPage.aspxPicture.gif111Aqui sou eu!Uma
> descrigcoPagina.aspxImagen.gif10/11/2004Test111Ich bin auch ein
> EintragUnd eine andere BeschreibungPage1.aspxPicture1.gif111Aqui sou
> eu, tambem!Uma outra descrigcoPagina1.aspxImagem1.gif</div>
>
> hmm, I don't even know exactly how to ask - but what the hell goes
> wrong here again?
>
> many thanks in advance!
>
> --
> Jan Limpens
> http://www.limpens.com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.