cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: XPathDirectory generator styling help
Date Mon, 06 Nov 2006 20:28:36 GMT
Hello,

did you manage to get it to work? Think you have some problems with xml/xsl transformations.
Also take into account the namespaces. If you are still having problems, please let us know,
or subscribe to some xsl mailinglist, like http://www.mulberrytech.com/xsl/xsl-list/.

Your problem is only xsl related, not browser. 

Regards


> 
> I would like to be able to drop valid xml files into a directory and
> have them appear automagically in a menu, with the ability to 
> transform
> the title of the article in the file into the text of a link 
> if I want.
> 
> I get the XPathDirectory generator to work with the following pipeline
> matcher.
> 
> <map:match pattern="articles/*">
> 	<map:generate type="xpathdirectory" src="articles/{1}">
> 		<map:parameter name="xpath" value="title"/>
> 		<map:parameter name="xmlFiles" value="\.x.*$"/>
> 	</map:generate>
> 	<map:serialize type="xml"/>
> </map:match>
> 
> The above matcher produces the following output.
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <dir:directory xmlns:dir="http://apache.org/cocoon/directory/2.0"
> name="articles" lastModified="1162301516000" date="31/10/06 07:31"
> size="4096" sort="name" reverse="false" requested="true">
> 	<dir:file name="article1.xml" lastModified="1162312230000"
> date="31/10/06 10:30" size="136">
> 		<dir:xpath query="title">
> 			<title>Article title</title>
> 		</dir:xpath>
> 	</dir:file>
> </dir:directory>
> 
> So far, so good. 
> 
> However, I would like to transform the XML so I can do other 
> things with
> it, such as a quick and dirty dynamic HTML menu or aggregate into
> another web page as XML and subsequently transform the title elements
> into links. I have attempted the following.
> 
> <xsl:template match="/">
>     <xsl:apply-templates/>
> </xsl:template>    
>     
>     <xsl:template match="article">
>         <xsl:value-of select="title"/>
>     </xsl:template>
> 
> When I add this XSL to the matcher, still serializing as XML 
> I get this
> result (when viewing the source).
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>Article title
> 
> Which looks OK, but Firefox complains with the following error.
> 
> XML Parsing Error: syntax error
> Location: http://localhost:8080/sandbox/articles/
> Line Number 1, Column 44:<?xml version="1.0"
> encoding="ISO-8859-1"?>Article title
> 			-------------------------------------------^
> Why is it encoded as ISO-8859-1? Everything in my sitemap says UTF-8.
> 
> This happens regardless of the charset I specify in Firefox. 
> Amaya also
> complains. 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message