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

AW: RSS 2.0 to RSS 1.0 XSLT problem in Luminis 3.3

Subject: AW: RSS 2.0 to RSS 1.0 XSLT problem in Luminis 3.3
From: "Huditsch, Roman \(LNG-VIE\)" <Roman.Huditsch@xxxxxxxxxxxxx>
Date: Wed, 12 Jul 2006 18:21:55 +0200
rss xslt rdf
Hi Seth,

You are getting transformation, because you are mixing up the XSL
instructions (although the error message seems a bit odd).

> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

You need to declare the namespace for the rdf prefix in your
<xsl:stylesheet>, too, since you need it in nearly all of your
templates.

> <xsl:template match="rss">
> <rdf:RDF
>   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>   xmlns="http://purl.org/rss/1.0/">
>
>   <xsl:template match="channel">
>     <channel>
> 	<xsl:attribute name="rdf:about"><xsl:value-of
> select="link"/></xsl:attribute>
> 	<title><xsl:value-of select="title"/></title>
> 	<description><xsl:value-of select="description"/></description>
> 	<image><xsl:attribute name="rdf:resource"><xsl:value-of
> select="image"/></xsl:attribute></image>
>     <items><rdf:Seq>
> 	  <xsl:for-each select="item">
> 	    <rdf:li>
> 		  <xsl:attribute name="rdf:resource"><xsl:value-of
> select="link"/></xsl:attribute>
> 		</rdf:li>
> 	  </xsl:for-each>
> 	</rdf:Seq></items>
>     <textinput><xsl:value-of select="textinput"/></textinput>
>     </channel>
>   </xsl:template>

Templates can't be nested in XSLT. If you want to apply templates for
other nodes in an template, use <xsl:apply-templates> instead.
<xsl:template> must be a child element of <xsl:stylesheet>.

>   <xsl:transform match="channel/image">
>     <image>
>       <xsl:attribute name="rdf:resource"><xsl:value-of
> select="url"/></xsl:attribute>
> 	  <title><xsl:value-of select="image/title"/></title>
> 	  <url><xsl:value-of select="image/url"/></url>
> 	  <link><xsl:value-of select="image/link"/></link>
>     </image>
>   </xsl:transform>

<xsl:transform> is a synonym for <xsl:stylesheet> and therefore
completely wrong here. You need to change this to be an <xsl:template
...> and move it one level up in your hierarchy. You should also include
an <xsl:apply-template> in your stylesheet invoking this template...

>   <xsl:for-each select="channel/item">
>     <item>
> 	  <xsl:attribute name="rdf:about"><xsl:value-of
> select="link"/></xsl:attribute>
> 	  <title><xsl:value-of select="title"/></title>
> 	  <link><xsl:value-of select="link"/></link>
> 	  <description><xsl:value-of
select="description"/></description>
> 	</item>
>   </xsl:for-each>

I think you should better include this part somewhere in your channel
template...

>   <xsl:transform match="channel/textinput">
>     <textinput>
> 	  <xsl:attribute name="rdf:about"><xsl:value-of
> select="url"/></xsl:attribute>
> 	  <title><xsl:value-of select="title"/></title>
> 	  <description><xsl:value-of
select="description"/></description>
> 	  <link><xsl:value-of select="link"/></link>
>     </textinput>
>   </xsl:transform>

This template needs to be under <xsl:stylesheet> as well.

> </rdf:RDF>
> </xsl:template>
>
> </xsl:stylesheet>

If your source document uses a namespace, you need to take that into
account, too.
I didn't have an appropriate RSS 2.0 document at hand, so I can't give
you more detailed information. If you could provide a simple input
document, I can give you an XSLT doing the job.

I hope this helps.

best regards,
Roman

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.