RE: [xsl] fragment in a variable

Subject: RE: [xsl] fragment in a variable
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 1 Dec 2004 22:42:13 -0000
The .NET processor is a 1.0 processor, therefore you can't address into a
result tree fragment like this:

$version/blog:Title

without the xx:node-set extension.

Even if you could, it would fail to find anything, because $version does not
contain any element nodes. You seem to have used xsl:value-of when you meant
xsl:copy-of.


Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: Jan Limpens [mailto:jan.limpens@xxxxxxxxx]
> Sent: 01 December 2004 22:15
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] fragment in a variable
>
> hi,
>
> I cannot explain to myself why this does not work....
>
> 	<xsl:template match="blog:Entry">
> 		<xsl:variable name="version">
> 			<xsl:choose>
> 				<xsl:when
> test="blog:Version[lang($selectedLanguage)]">
> 					<xsl:value-of
> select="blog:Version[lang($selectedLanguage)]"/>
> 				</xsl:when>
> 				<xsl:otherwise>
> 					<xsl:value-of
> select="blog:Version[lang($defaultLanguage)]"/>
> 				</xsl:otherwise>
> 			</xsl:choose>
> 		</xsl:variable>
>
> 		<site:title>
> 			<xsl:value-of select="$version/blog:Title"/>
> 		</site:title>
> 		<site:description>
> 			<xsl:value-of
> select="$version/blog:Body/blog:Para[1]"/>
> 		</site:description>
> 		<xsl:if test="blog:Thumbnail/@src">
> 			<site:thumbnail>
> 				<xsl:value-of
> select="blog:Thumbnail/@src"/>
> 			</site:thumbnail>
> 		</xsl:if>
> 	</xsl:template>
>
> throws "The expression passed to this method should result in a
> NodeSet." (.NET processor)
> what should I do?
>
> a xml file would look like this...
>
> <?xml version="1.0"?>
> <Entry pubdate="2004-09-15T00:00:00" id="iEditoraComics"
> xmlns="http://limpens.com/blogbase";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://limpens.com/blogbase Schemas/BlogBase.xsd">
> 	<Version xml:lang="en">
> 		<Title>Promo Comics</Title>
> 		<Body>
> 			<Para>IEditora, a Brazilian
> self-publishing house now promotes its
> products using comics strips.</Para>
> 			<Para>Comics as a medium of
> advertisment is a quite unusual choice.
> Still it brings many advantages and possibilities known only from tv
> commercials to the much more affordable print medium.</Para>
> 		</Body>
> 	</Version>
> 	<Version xml:lang="pt">
> 		<Title>Quadrinhos de propaganda</Title>
> 		<Body>
> 			<Para>A editora paulistana IEditora me
> contratou de produzir uma
> serie de quadrinhos sobre os seus servigos oferecidos.</Para>
> 		</Body>
> 	</Version>
> 	<Version xml:lang="de">
> 		<Title>Werbecomics</Title>
> 		<Body>
> 			<Para>IEditora, ein brasilianischer
> Verlag, beauftragte mich, eine
> Serie von Comics zu produzieren, die ihr Angebot ins beste Licht
> r|ckt.</Para>
> 		</Body>
> 	</Version>
> 	<Slideshow>
> 	<Image src="Images/Slideshows/iEditora/iEditora-Caesar.png">
> 		<ImageInfo xml:lang="en">
> 			<Title>Et In Editora Ego</Title>
> 			<Description>October 2004</Description>
> 		</ImageInfo>
> 	</Image>
> 	<Image
> src="Images/Slideshows/iEditora/IEditora-Promo-Comic-2-1.png">
> 		<ImageInfo xml:lang="en">
> 			<Title>The Importace Of Being Biographed</Title>
> 			<Description>September 2004</Description>
> 		</ImageInfo>
> 	</Image>
> 	<Image src="Images/Slideshows/iEditora/ieditora_promo-1.png">
> 		<ImageInfo xml:lang="en">
> 			<Title>The Hell Of Being Unpublished</Title>
> 			<Description>January 2004</Description>
> 		</ImageInfo>
> 	</Image>
> 	</Slideshow>
> 	<Thumbnail src="/Images/Thumbnails/teaser_ieditora_promo.png"/>
> </Entry>
>
> thanks a lot!
> --
> Jan
> http://www.limpens.com
>
> Otakoo Saloon Cartoon - newest episode at
> http://limpens.com/oscredirect

Current Thread