My God, you're right! I didn't even notice that. That example now works, thanks to you.


Now here's the more general thing I'd like to do... The XML doc I'm transforming has a tag like this:

<rp:content replace-with="navigationMenu"/>

and, using my XSL stylesheet, I want to transform it to this:

<cinclude:include src="someSpecificSourceName"/>

The catch (and why I'm using xsl:params) is that the "src" for the <cinclude:include> should be an xsl:param passed into the XSL stylesheet with the "navigationMenu" name (in this example).

So I'm trying to write a template to do this. Here's what I'm trying, but is not working:

<xsl:template match="rp:[EMAIL PROTECTED]">
 <cinclude:include src="[EMAIL PROTECTED]"/>
</xsl:template>

This is the output:

<cinclude:include xmlns:cinclude="http://apache.org/cocoon/include/1.0"; src=""/>

Note the src="". What am I doing incorrectly?

From: Conal Tuohy <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: RE: Pass sitemap params to "xslt" transformer?
Date: Sun, 12 Oct 2003 14:59:21 +1300

Whoops! Another error:
<xsl:param name="centerPage" value="'home'"/>

This should say:
<xsl:param name="centerPage" select="'home'"/>

Confusion between sitemap syntax and xslt syntax! :-)

Con


> -----Original Message----- > From: Sonny Sukumar [mailto:[EMAIL PROTECTED] > Sent: Sunday, 12 October 2003 14:42 > To: [EMAIL PROTECTED] > Subject: RE: Pass sitemap params to "xslt" transformer? > > > > Hi Con, > > Thank you very much for your suggestions. I implemented both > suggestions > and now I get: > > <cinclude:include > xmlns:cinclude="http://apache.org/cocoon/include/1.0"; > src=""/> > > Here's my stylesheet: > <?xml version="1.0"?> > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; > version="1.0" > > xmlns:rp="http://www.mysite.com/rp"; > > xmlns:cinclude="http://apache.org/cocoon/include/1.0";> > <xsl:param name="centerPage" value="'home'"/> > > <xsl:template match="rp:[EMAIL PROTECTED]'centerPage']"> > <cinclude:include src="{$centerPage}" /> > </xsl:template> > > <!---+ > | If a specific template does not exist for the > current node, simply > copy > | it to the result document. > +--> > <xsl:template match="@*|node()" priority="-1"> > <xsl:copy> > <xsl:apply-templates select="@*|node()"/> > </xsl:copy> > </xsl:template> > </xsl:stylesheet> > > Thanks again, > > Sonny > > >From: Conal Tuohy <[EMAIL PROTECTED]> > >Reply-To: [EMAIL PROTECTED] > >To: [EMAIL PROTECTED], [EMAIL PROTECTED] > >Subject: RE: Pass sitemap params to "xslt" transformer? > >Date: Sun, 12 Oct 2003 14:42:36 +1300 > > > >Sonny, you need: > > > ><cinclude:include src="{$centerPage}"/> > > > >Note the curly brackets! This is an "Attribute Value > Template". If you miss > >the { } then "$centerPage" is interpreted as a string literal! > > > >Also, the parameter declaration looks wrong to me. I'm not > sure, I don't > >think you really want: > > > ><xsl:param name="centerPage" value="home"/> > > > >This will assign the centerPage variable a value equal to the nodeset > >containing the root node of your document, if that node's > name is "home", > >or > >if that's not the name of the root node, then centerPage > will equal the > >empty nodeset. > > > >I think you probably want: > > > ><xsl:param name="centerPage" value="'home'"/> > > > >This would assign it the string literal "home" > > > >Cheers > > > >Con > > > > > > > -----Original Message----- > > > From: Sonny Sukumar [mailto:[EMAIL PROTECTED] > > > Sent: Sunday, 12 October 2003 11:07 > > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > > > Subject: RE: Pass sitemap params to "xslt" transformer? > > > > > > > > > > > > --Update-- > > > > > > I tried the map:transform without passing any > > > <map:parameter>s at all, so > > > just the default xsl:param value in the XSL stylesheet will > > > be used (see > > > prev. message below). > > > > > > I also made the template simpler. Just this now: > > > <xsl:template match="rp:[EMAIL PROTECTED]'centerPage']"> > > > <cinclude:include src="$centerPage" /> > > > </xsl:template> > > > > > > Anyhow, the output I'm getting is: > > > <cinclude:include > > > xmlns:cinclude="http://apache.org/cocoon/include/1.0"; > > > src="$centerPage"/> > > > > > > This indicates the param *value* isn't being substituted. > > > Why might this > > > be? > > > > > > >From: "Sonny Sukumar" <[EMAIL PROTECTED]> > > > >Reply-To: [EMAIL PROTECTED] > > > >To: [EMAIL PROTECTED], [EMAIL PROTECTED] > > > >Subject: RE: Pass sitemap params to "xslt" transformer? > > > >Date: Sat, 11 Oct 2003 12:55:20 -0700 > > > > > > > > > > > >Ok, I can't get the <map:parameter> value to work in the > > > XSL. I keep > > > >getting a ResourceNotFoundException. I even tried hardcoding the > > > >map:parameter value, but it still doesn't work. Here's > the sitemap > > > >map:transform: > > > > > > > ><map:transform type="xslt" > > > src="mysite/xsl/customerFacingTemplate.xsl"> > > > > <map:parameter name="centerPage" > > > > > > > >value="cocoon:/internal/showProduct?productId=00123"/> > > > ></map:transform> > > > > > > > >The XSL is: > > > > > > > ><?xml version="1.0"?> > > > > > > > ><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; > > > >version="1.0" > > > > > > > xmlns:rp="http://www.redpouch.com/rp"; > > > > > > > xmlns:cinclude="http://apache.org/cocoon/include/1.0";> > > > > <xsl:param name="centerPage" value="home"/> > > > > > > > > <xsl:template match="rp:[EMAIL PROTECTED]"> > > > > <cinclude:include src="[EMAIL PROTECTED]"/> > > > > </xsl:template> > > > > > > > > <!-- 1 other template to copy all other tags over --> > > > ></xsl:stylesheet> > > > > > > > >The specific error is this: > > > >org.apache.cocoon.ProcessingException: Failed to execute > pipeline.: > > > >java.lang.RuntimeException: > > > org.apache.cocoon.ResourceNotFoundException: > > > >Resource not found.: > > > org.apache.excalibur.source.SourceNotFoundException: > > > >file:/usr/local/tomcat/webapps/cocoon/$centerPage doesn't exist > > > > > > > >Any ideas?? > > > > > > > >Thanks, > > > > > > > >Sonny > > > > > > > >>From: "Horsfield, Peter A." <[EMAIL PROTECTED]> > > > >> > > > >>Absolutely: > > > >> > > > >> <map:transform type="xslt"> > > > >> <map:parameter name="paramName" value="{1}" /> > > > >> </map:transform> > > > >> > > > >>Then, in your XSLT file at the top level (under stylesheet) > > > >> > > > >> <xsl:param name="paramName" value="defaultvalue" /> > > > >> > > > >>I've had problems using hyphens in parameter names, however. > > > >> > > > >>Peter > > > >> > > > >>-----Original Message----- > > > >>From: Sonny Sukumar [mailto:[EMAIL PROTECTED] > > > >>Sent: Wednesday, October 08, 2003 3:03 PM > > > >>To: [EMAIL PROTECTED] > > > >>Subject: Pass sitemap params to "xslt" transformer? > > > >> > > > >> > > > >> > > > >>Is there any way to pass *sitemap* parameters to the "xslt" > > > transformer > > > >>(TraxTransformer)? I know there's a > > > "use-request-parameters" option to > > > >>use > > > >>request parameters, but that's not what I want to do. > > > >> > > > >>I want to at least be able to pass in the request URI (e.g. > > > "requestUri" > > > >>in > > > >>"http://www.mysite.com/requestUri?id=12345";), but passing > > > in parameters > > > >>with > > > >> > > > >>names/values of my choosing from the sitemap would be better. > > > >> > > > >>Thanks for the help, > > > >> > > > >>Sonny > > > >> > > > > >>_________________________________________________________________ > > > >>Add MSN 8 Internet Software to your existing Internet > > > access and enjoy > > > >>patented spam protection and more. Sign up now! > > > >>http://join.msn.com/?page=dept/byoa > > > >> > > > >> > > > >>------------------------------------------------------------ > > > --------- > > > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > > > >>For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > >_________________________________________________________________ > > > >Add MSN 8 Internet Software to your existing Internet access > > > and enjoy > > > >patented spam protection and more. Sign up now! > > > >http://join.msn.com/?page=dept/byoa > > > > > > > > > > > > >--------------------------------------------------------------------- > > > >To unsubscribe, e-mail: [EMAIL PROTECTED] > > > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > _________________________________________________________________ > > > Help protect your PC. Get a FREE computer virus scan online > > > from McAfee. > > > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > _________________________________________________________________ > Instant message with integrated webcam using MSN Messenger > 6.0. Try it now > FREE! http://msnmessenger-download.com > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
High-speed Internet access as low as $29.95/month (depending on the local service providers in your area). Click here. https://broadband.msn.com



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to