cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From H.vanderLin...@MI.unimaas.nl
Subject RE: multiple xpaths in XPathDirecory
Date Tue, 13 Jan 2004 22:02:19 GMT
Ah, wild guess: the XPathDirectoryGenerator uses @name to give the original
filename. I was also unable to get xpath1|xpath2 working when both
expressions contained attributes. I was able to change the XML file to make
tags out of the attributes after that it worked.

My sitemap:

    <map:generate type="xpathdirectory" src="content/xmlforms">
                    <map:parameter name="xpath" value="/form/label |
/form/code"/>
                    <map:parameter name="xmlFiles" value="\.xml$"/>
                </map:generate>
                <map:transform src="stylesheets/formlist.xsl"/>
                <map:serialize type="xml"/>
            </map:match>

My formlist.xsl:

	<xsl:template match="/">
		<forms>
			<xsl:apply-templates/>
		</forms>
	</xsl:template>
	<xsl:template match="dir:file">
		<xsl:if test="substring-after(@name,'.')='xml'">
		<form>
			<file><xsl:value-of select="substring-before(@name,
'.')"/></file>
			<fullfile><xsl:value-of select="@name"/></fullfile>
			<code><xsl:value-of select="dir:xpath/code"/></code>
			<label><xsl:value-of
select="dir:xpath/label"/></label>
		</form>
		</xsl:if>
	</xsl:template>

Hope this helps.

Bye, Helma

> -----Original Message-----
> From: rufio [mailto:ruf10@op.pl] 
> Sent: Tuesday, 13 January 2004 16:49
> To: users@cocoon.apache.org
> Subject: Re: multiple xpaths in XPathDirecory
> 
> 
> on Tue, 13 Jan 2004 16:02:50 +0100 H.vanderLinden@MI.unimaas.nl wrote:
> 
> > Doesn't the xpath1|xpth2 query result in <xpath1-tag> and 
> <xpath2-tag> in
> > the resulting XML? In that case you only need to use an XSL 
> stylesheet to
> > get whatever you want.
> 
> no, see below.
> 
> > > Hi
> > > I'm trying to get 2 informations from xml files with 
> > > XPathDirectory generator:
> > > /page/@name and /page/@category but I found that I can't use 
> > > xpath parameter
> > > more than once (thanx avalon).
> > > I also found that the xpath parameter can be of form 
> > > "xpath1|xpath2" but the
> > > result is unsplitable namecategory.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Regards, Rufio
> --
> 010 > XMMS now playing
> 001 >                 Turbo
> 111 >                      Do potwora
> 
> ---------------------------------------------------------------------
> 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