cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Bonneau <rg1...@gmail.com>
Subject RE: retrieving requested filename in XSL
Date Wed, 22 Jul 2009 11:27:29 GMT

my <xsl:param> were misplaced as you suggested:


  <xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns="http://www.w3.org/1999/xhtml">
  <xsl:param name="filename" />
  <xsl:template match="page">
   <html>
    <head>
     ...
    </head>
    <body>
      <div class="content">
      ...
      </div>
      
      <div class="footer">
      	 	
                <xsl:param name="filename" />
      		<xsl:attribute name="href">
      			doc-<xsl:value-of select="$filename"  />.pdf
      		</xsl:attribute>
      		Version PDF
      	 
      </div>

    </body>
   </html>
  </xsl:template>
 </xsl:stylesheet>




My problem was solved when I moved <xsl:param name="filename" /> as a child
of the root (<xsl:stylesheet> )


Thanks you very much.


Robby Pelssers-3 wrote:
> 
> I hope you put the xsl:param at top level of your xslt??  Otherwise it
> will not work.
> 
> <xsl:param> does have a scope so you should not declare that <xsl:param>
> for instance inside a <xsl:template match=""> if you pass it on from
> your sitemap.
> 
> First show me how (read where) you declared the parameter filename in
> your xslt.
> 
> Cheers,
> Robby Pelssers
> 
> -----Original Message-----
> From: Jean-Bonneau [mailto:rg1693@gmail.com] 
> Sent: Wednesday, July 22, 2009 11:51 AM
> To: users@cocoon.apache.org
> Subject: retrieving requested filename in XSL
> 
> 
> Hello,
> 
> I want to ouput the filename requested in the URL in an XSL stylesheet
> (e.g.
> get "toolz" from http://server/cocoon/page-toolz), but it doesn't work.
> 
> 
> Here is the involved part of the sitemap:
>    ...
>    <map:match pattern="page-*">
>      <map:generate src="content/pages/{1}.xml"/>
>      <map:transform src="style/xsl/page2html.xsl">
> 		<map:parameter name="filename" value="{1}" />
> 	 </map:transform>
>      <map:serialize type="xhtml" />
>    </map:match>
>    ...
> 
> 
> Then, the xsl style/xsl/page2html.xsl  markup:
> ...
>          
>       		<xsl:param name="filename" />
>       		<xsl:attribute name="href">
>       			doc-<xsl:value-of select="$filename"  />.pdf
>       		</xsl:attribute>
>       		Version PDF
>       	 
> 
> 
> But this always print  doc-.pdf  
> I tried <xsl:variable name="filename" /> instead of <xsl:param
> name="filename" />, but it doesn't work either.
> 
> Can you help me gess why isn't the parameter working ?
> 
> 
> Thanks.
> 
> 
> Rodolphe GOHARD.
> -- 
> View this message in context:
> http://www.nabble.com/retrieving-requested-filename-in-XSL-tp24603200p24
> 603200.html
> Sent from the Cocoon - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/retrieving-requested-filename-in-XSL-tp24603200p24604572.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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


Mime
View raw message