xsl-list
[Top] [All Lists]

RE: Need xml dir list by dc:title

2003-07-22 09:09:55
Hi.

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
hgadm(_at_)cswebmail(_dot_)com
Sent: Tuesday, July 22, 2003 3:21 PM
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
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="{(_at_)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



<Prev in Thread] Current Thread [Next in Thread>