RE: [xsl] Need xml dir list by dc:title

Subject: RE: [xsl] Need xml dir list by dc:title
From: Américo Albuquerque <melinor@xxxxxxx>
Date: Tue, 22 Jul 2003 17:09:55 +0100
Hi.

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> hgadm@xxxxxxxxxxxxx
> Sent: Tuesday, July 22, 2003 3:21 PM
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Need xml dir list by dc:title
> 
> 
> Dear all,
> 
> I want to provide a (dynamically generated) HTML page
> with links to all XML files in a given directory.
> 
> The links should however not named by the xml file name
> but with the <dc:title> element of these xml files.
> 
> I've got a nice solution with cocoon using the 
> XPathFileGenerator, but I cannot run Cocoon in the current 
> environment so I would need a pure XML/XSL solution.
> 
> Any help is greatly appreciated !
> 
> -Holger
> 

You'll need to create a xml file with the files in your directory. The way
you create this file depends on your system
One possible file format could be:
<?xml version="1.0"?>
<dir>
  <file name="file1.xml"/>
  <file name="file2.xml"/>
  ...
  <file name="fileN.xml"/>
</dir>

Then you'll apply this stylesheet:

<xsl:template match="dir">
 <P>Some discription</P>
 <xsl:apply-templates select="file"/>
</xsl:template>

<xsl:template match="file">
 <a href="{@name}"><xsl:value-of
select="document(@name)/root/dc:title"/></a><br/>
</xsl:template>

Heach fileX.xml will have the following format:
<?xml version="1.0"?>
<root xmlns:dc="some namespace definition">
  <dc:title>title</dc:title>
  ...
</root>

Hope this helps you.



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread