Re: Converting XML via XSLT to HTML page

Etienne Robillard <granted14-/[email protected]> Mon, 25 Jul 2005 11:38:41 -0400 (EDT)
Newsgroups gmane.network.syndication.rss.devel
Message-ID <[email protected]>
Hi, 
--- parkwood149 <[email protected]> wrote:

> I am trying to convert an xml file to HTML and have
> it look similiar to the CSS 
> styleesheet. I am getting stuck with the XSLT. Can
> someone advise? Or does 
> someone have a XSLT I can use to learn from.

You might want to take a look at
http://sourceforge.net/projects/libverticale.

Its a set of XSLT stylesheets for converting XML
documents to HTML (and RSS). 

They're specific to making a art-gallery but you can
use them as templates for your project if you want.

> the XML file is:
> <?xml version="1.0" encoding="UTF-8"?>
> <?xml-stylesheet href="rss1.css" type="text/css"?>
> 
> <rss version="2.0">
> <channel> 
> 	<title>prsa.org </title> 
> 	<link>http://www.prsa.org</link> 

In general, I found easier to write data-oriented XMLs
rather than document-oriented XMLs. 

Example: 

<company:company>
 <company:name>prsa.org</company:name>
 <company:url>http://www.prsa.org</company:url>
 <company:description>etc etc</company:description>
</company:company>

> <!-- Matching RSS FEED Characteristics -->
> <xsl:template match="rss">
> 	<html xmlns="http://www.w3.org/1999/xhtml">
> 		<head>
> 			<title><xsl:apply-templates
> select="rss/channel/description" /></title>
> 		</head>
> 		<body>
> 			<xsl:apply-templates />
> 		</body>
> 	</html>
> </xsl:template>

Just match your stylesheets as you did for the case of
"rss" but transform them as html or maybe rdf:

<!-- RSS:title -->
<xsl:template match="company:name">
   <xsl:element name="title">
     <xsl:value-of select='.' />
   </xsl:element>
</xsl:template>


  HTH,
  -- erob

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/rss-dev/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/