[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] how can I use this values


Subject: RE: [xsl] how can I use this values
From: Roelof Wobben <rwobben@xxxxxxxxxxx>
Date: Wed, 6 Jun 2012 18:37:51 +0000

Thanks



I know.

I work to little with xml and xslt to get really familiair with it.



But I have another problem.



I have now this :





<xsl:template match="data">
     <xsl:apply-templates select="item-search-dagboek/entry" />
     <xsl:apply-templates select="item-search-frontpage/entry" />
     <xsl:variable name="totalPages"
select="search/pagination/@total-pages"/>
     <xsl:variable name="currentPage"
select="search/pagination/@current-page"/>
     <xsl:variable name="zoek" select="search/@keywords" />
     <div class="post-nav">
          <xsl:if test=" $currentPage &gt; 1" >
                  <span class="previous">
                        <a href="{$root}/search-page/?keywords=($zoek)& " >
</a>

                  </span>
          </xsl:if>
</div>



As soon as I put a & behind the keywords=($zoek) I get this complain :



This document is not well formed. The following error was returned: loadXML():
xmlParseEntityRef: no name in Entity, line: 17





I try to make a url like this :
http://test.tamarawobben.nl/search-page/?keywords=mama&per-page=3&page=2



How can I solve this ?



Roelof









----------------------------------------
> Date: Wed, 6 Jun 2012 13:47:03 -0400
> From: dbf.whitney@xxxxxxxxx
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] how can I use this values
>
> Roelof it would be something like this:
> <xsl:template match="search">
> <xsl:variable name="totalPages" select="pagination/@total-pages"/>
> <xsl:variable name="currentPage" select="pagination/@current-page"/>
> <xsl:if test="$currentPage &lt; ($totalPages - 1)">
> then do something here
> </xsl:if>
> </xsl:template>
>
> I think however you're going to have to spend a little time figuring
> out the basics of XSL.
>
> Dan
>
> 2012/6/6 Roelof Wobben <rwobben@xxxxxxxxxxx>:
> >
> > Oke,
> >
> >
> >
> > And then I can use totalpages and current page like this :
> >
> >
> >
> > <xsl:if current page < total pages -1 >
> >
> > <div class="post-nav">
> > <span class="next">
> > <a href="http://test.tamarawobben.nl/dagboek/2005/04/2"></a>
> > </span>
> > </div>
> > </xsl: if>
> >
> >
> >
> > Roelof
> >
> >
> >
> >
> >
> > ----------------------------------------
> >> Date: Wed, 6 Jun 2012 13:11:10 -0400
> >> From: dbf.whitney@xxxxxxxxx
> >> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >> Subject: Re: [xsl] how can I use this values
> >>
> >> <xsl:template match="search">
> >>
> >> Total pages = <xsl:value-of select="pagination/@total-pages"/>
> >> Current page = <xsl:value-of select="pagination/@current-page"/>
> >>
> >> </xsl:template>
> >>
> >> 2012/6/6 Roelof Wobben <rwobben@xxxxxxxxxxx>:
> >> >
> >> > Hello,
> >> >
> >> > Sorry for the maybe stupid question
> >> >
> >> > But I have this xml :
> >> >
> >> > <search keywords="mama" sort="score" direction="desc">
> >> > <alternative-keywords>
> >> > <keyword original="mama" alternative="man" distance="2" />
> >> > </alternative-keywords>
> >> > <pagination total-entries="36" total-pages="12" entries-per-page="3"
> >> > current-page="1" />
> >> > <sections>
> >> > <section id="6" handle="Sections">Sections</section>
> >> > <section id="9" handle="Dagboek">Dagboek</section>
> >> > </sections>
> >> > <entry id="136" section="Dagboek">
> >> > <excerpt><p>Vandaag was het de grote dag, je hebt voor het eerst heel
> >> > bewust <strong>mama</strong> gezegd. Ik had al wel in de gaten dat het
eraan
> >> > zat te komen, ja was al een hele tijd bezig met
> >> > <strong>mama</strong><strong>mama</strong>ma. Een mooi
verjaardagscadeautje
> >> > meisje, een heel goede timing. Dank je wel. Je zegt nu twee woorden,
papa en
> >> > <strong>mama</strong>.</p>
> >> > </excerpt>
> >> > </entry>
> >> > <entry id="62" section="Dagboek">
> >> > <excerpt><p> boos maken van de arts, er komt dan meer bloed. Je word
> >> > maar heel even boos en blijft mee aankijken met een blik van waarom
> >> > <strong>mama</strong>? De arts geeft het op en laat een laborant komen
voor
> >> > een hielprik. Je hiel wordt alvast in een gelpakking gedaan. Papa het
> >> > slapen gaan bel ik nog even naar de Nicu. Jouw temperatuur zakt een
klein
> >> > beetje, van 38,4 is het nu 37,9 C. Waarom <strong>mama</strong>
> >> > 2005-09-11</p></excerpt>
> >> > </entry>
> >> > <entry id="126" section="Dagboek">
> >> > <excerpt><p> horen. Jouw babbels deed je wel na als wij het vroegen.
> >> > Natuurlijk oefenen we al een tijdje met je om woordjes als papa en
> >> > <strong>mama</strong> te zeggen. Je was de laatste tijd al druk in je
eentje
> >> > aan het oefenen, maar als wij papa of <strong>mama</strong> tegen jou
> >> > zeiden, deed je het ons niet na. Tot vandaag. Je hebt je eerste
woordje
> >> > gezegd en het is PAPA geworden. Geeft</p></excerpt>
> >> > </entry>
> >> > </search>`
> >> >
> >> >
> >> > How can I use the values of total_pages and current-page in a <xml
> >> > value-of select = " " />
> >> >
> >> > Roelof


Current Thread
Keywords