RE: [xsl] can a value of a parameter depends on a other value

Subject: RE: [xsl] can a value of a parameter depends on a other value
From: Roelof Wobben <rwobben@xxxxxxxxxxx>
Date: Wed, 30 Nov 2011 11:41:46 +0000
Oke,



But im rewriting this piece so I will use it.



What im trying is to declare a variable/parameter which value depends on the
month and page parameter.



Is there then a better way to to this.



Roelof



----------------------------------------
> Date: Wed, 30 Nov 2011 12:08:39 +0100
> From: wolfgang.laun@xxxxxxxxx
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] can a value of a parameter depends on a other value
>
> A parameter is only applicable to a named template, and
> <xsl:with-param> is used with the call, not the definition. You aren't
> using the "parameter" anyway, so omit it.
> -W
>
> On 30 November 2011 12:02, Roelof Wobben <rwobben@xxxxxxxxxxx> wrote:
> >
> >
> > Oke,
> >
> >
> >
> >
> >
> > The whole xslt looks like this :
> >
> >
> >
> >
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> >
> > <xsl:output method="xml"
> > doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
> > doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
> > omit-xml-declaration="yes"
> > encoding="UTF-8"
> > indent="yes" />
> >
> >
> >
> > <xsl:variable name="mycount" select="count(/data/artikel-details/entry)"
/>
> >
> >
> >
> > <xsl:template match="/">
> > <xsl:with-param name="articlesperpage">
> > <xsl:choose>
> > <xsl:when test=" $value = 2005-02 and $page = 1">2</xsl:when>
> > </xsl:choose>
> > </xsl:with-param>
> > <xsl:apply-templates select="/data/artikel-details/entry"/>
> > </xsl:template>
> >
> >
> >
> >
> >
> > <xsl:template match="artikel-details/entry">
> > <h1><xsl:value-of select="titel"/></h1><br />
> > <xsl:value-of select="datum" /><br />
> > <xsl:value-of select="tekst" /> <br />
> > </xsl:template>
> >
> >
> >
> > I only get now this message :
> >
> >
> >
> > XSLTProcessor::importStylesheet(): element with-param is not allowed
within that context
> >
> > XSLTProcessor::transformToXml(): No stylesheet associated to this object
> >
> >
> >
> >
> > I hope I now give enought clues to solve this.
> >
> >
> >
> > Roelof
> >
> >
> >
> >
> >
> >
> >
> > </xsl:stylesheet>----------------------------------------
> > > Date: Wed, 30 Nov 2011 10:47:01 +0000
> > > From: davidc@xxxxxxxxx
> > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > Subject: Re: [xsl] can a value of a parameter depends on a other value
> > >
> > > On 30/11/2011 10:22, Roelof Wobben wrote:
> > > >
> > > >
> > > >
> > > > Hello,
> > > >
> > > >
> > > >
> > > > This script does not work
> > >
> > > you are posting a lot of questions but not really giving anyone any
> > > clues that could enable us to help.
> > > >
> > > >
> > > >
> > > > <xsl:with-param name="articlesperpage">
> > > > <xsl:choose>
> > > > <xsl:when test=" $value = 2005-02 and $page = 1">2</xsl:when>
> > > > </xsl:choose>
> > > > </xsl:with-param>
> > > >
> > > >
> > > > I see now these error messages :
> > > >
> > >
> > > The error message clearly states that you have used xsl:with-param at a
> > > place where it is not allowed, and lists the places where it is
allowed.
> > > presumably you have used it in some other place but as you only posted
> > > the with-param and not show where it was, we can't help.
> > >
> > > Incidentally
> > >
> > > $value = 2005-02
> > >
> > > is legal but tests if $value has the value 2003. If you meant to test
> > > for the string 2005-02 then you need quotes
> > > $value = '2005-02'
> > > >
> > > >
> > > > XSLTProcessor::importStylesheet(): element with-param is not allowed
within that context
> > > >
> > > > XSLTProcessor::importStylesheet(): element choose only allowed within
a template, variable or param
> > > >
> > > > XSLTProcessor::importStylesheet(): xsltParseStylesheetTop: unknown
with-param element
> > > >
> > > > XSLTProcessor::transformToXml(): No stylesheet associated to this
object
> > > >
> > > >
> > > David
> > >
> > >
> > >
________________________________________________________________________
> > > The Numerical Algorithms Group Ltd is a company registered in England
> > > and Wales with company number 1249803. The registered office is:
> > > Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
> > >
> > > This e-mail has been scanned for all viruses by Star. The service is
> > > powered by MessageLabs.
> > >
________________________________________________________________________

Current Thread