namespaces and <xsl:value-of>

R

Rainer Herbst

Hi *,

please help me solving the following problem:

I have an XML document containing elements like
<dir:directory xmlns:dir="http://apache.org/cocoon/directory/2.0"
name="pressemitteilungen" lastModified="1064833858000" date="29.09.03
13:10" size="4096" sort="name" reverse="false" requested="true">
<dir:file name="first.xml" lastModified="1064833858000" date="29.09.03
13:10" size="62"/>
</dir:directory>

How should I refer to these elements in
<xsl:value-of/> ?

<xsl:value-of select="//dir:file"/>
gives me an error, so what can I do?

TIA!
Rainer


--
 
F

Francesc Guim Bernat

Rainer said:
Hi *,

please help me solving the following problem:

I have an XML document containing elements like
<dir:directory xmlns:dir="http://apache.org/cocoon/directory/2.0"
name="pressemitteilungen" lastModified="1064833858000" date="29.09.03
13:10" size="4096" sort="name" reverse="false" requested="true">
<dir:file name="first.xml" lastModified="1064833858000" date="29.09.03
13:10" size="62"/>
</dir:directory>

How should I refer to these elements in
<xsl:value-of/> ?

<xsl:value-of select="//dir:file"/>
gives me an error, so what can I do?

I supose that you've not declaret the namespace "dir" in your stylesheet
node of your XSTL. You must declare it, for instance:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dir="http://apache.org/cocoon/directory/2.0"<xsl:eek:utput method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:value-of select="//dir:file"/>

<!-- Your xstl code -->
</xsl:stylesheet>


Francesc Guim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top