cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott_B...@lotus.com
Subject Re: Found Xalan Problem and new Cocoon feature
Date Sat, 04 Mar 2000 03:00:17 GMT

>  <xsl:template match="slide['$slide']">
>  .... do some processing
> </xsl:template>

Why do you have the single quotes around $slide?  I think you want
something like:

<xsl:template match="slide[$slide]">
  .... do some processing
</xsl:template>

If understand what you are trying to do:

<?xml version="1.0"?>
<presentation>
  <slide>a</slide>
  <slide>b</slide>
  <slide>c</slide>
  <slide>d</slide>
  <slide>e</slide>
</presentation>

and:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version
="1.0">

<xsl:param name="slide-number"/>

<xsl:template match="presentation">
     <out>
          <xsl:apply-templates select="slide"/>
     </out>
</xsl:template>

<!-- catch the slide for the slide-number param -->
<xsl:template match="slide[$slide-number]">
  slide: <xsl:value-of select="."/>
</xsl:template>

<!-- catch all the rest -->
<xsl:template match="slide">
  <!-- empty -->
</xsl:template>

</xsl:stylesheet>

and do from the command line:

testo test\test -param slide-number 3

I get:

<?xml version="1.0" encoding="UTF-8"?>
<out>
  slide: c</out>

But I would think this would be easier, if I understand what you want to
do, by doing simply:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version
="1.0">

<xsl:param name="slide-number"/>

<xsl:template match="presentation">
     <out>
          <xsl:apply-templates select="slide[$slide-number]"/>
     </out>
</xsl:template>

<!-- catch the slide for the slide-number param -->
<xsl:template match="slide">
  slide: <xsl:value-of select="."/>
</xsl:template>

</xsl:stylesheet>

-scott




                                                                                         
                    
                    Stefano                                                              
                    
                    Mazzocchi            To:     Cocoon <cocoon-dev@xml.apache.org>
                          
                    <stefano@apac        cc:     Scott Boag <Scott_Boag/CAM/Lotus@lotus.com>
                 
                    he.org>              Subject:     Found Xalan Problem and new Cocoon
feature              
                                                                                         
                    
                    03/03/00                                                             
                    
                    09:35 PM                                                             
                    
                                                                                         
                    
                                                                                         
                    




I just fixed concurrency Xalan problem in Cocoon. It was my fault since
I was sharing the same processor between threads. I should be fixed now.

I also managed to passed param requests to Xalan as stylesheet
parameters so, in something like this works

 index.xml?param=hello


<xsl:param name="hello"/>

<xsl:template ....>
 ....
 <xsl:value-of select="$hello"/>
</xsl:template>

----------- so far so good -------------

But there's a problem and I'm not sure if this is a Xalan bug or my
wrong understandings of the xSLT spec.

I'm doing my apachecon presentation and I would like to do something
like this:

 slides.xml?slide=5

then in an xml file such as

 <presentation>
  <slide>...</slide>
  <slide>...</slide>
  <slide>...</slide>
  <slide>...</slide>
  <slide>...</slide>
 </presentation>

and a stylesheet like

 <xsl:template match="slide['$slide']">
  .... do some processing
 </xsl:template>

 <xsl:template match="slide" priority="-1">
  <!-- ignore the other slides -->
 </xsl:template>

to print just the exact slide.

But the above doesn't work... even if

 <xsl:value-of select="$slide"/>

does output the requested slide number.

Is this a Xalan bug????

Please answer quickly because if this is, I'll have to find a different
media to do my presentation :(

--
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Come to the first official Apache Software Foundation Conference!
------------------------- http://ApacheCon.Com ---------------------






Mime
View raw message