[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: problem with proper counting

Subject: Re: problem with proper counting
From: "Andreas Putscher" <andreasputscher@xxxxxx>
Date: Wed, 24 Oct 2001 09:12:11 +0200
problem with anchor xsl
Thanks I have been able to solve this problem, but know I have another one:
Each page should have a link to the next page and to the previous page, like
this:

<h1>set1</h1>
  <a href="#1-1">page1</a></br>
  <a href="#1-2">next page</a></br>
(no previous page in here)

  <a href="#1-2">page2</a></br>
  <a href="#1-3">next page</a></br>
  <a href="#1-1">previous page</a></br>

  <a href="#1-3">page3</a></br>
....
</set>

<h1>set2</h1>
   <a href="#2-1">page4</a></br>
....
<a href="#2-2">page5</a></br>
.....
</set>

The problem occurs when I want to create a link to a page of another set
like with page 3 and 4. I think I would have to know the number of pages
each set contains in advance. That`s what my template rule is like right
now:

<xsl:for-each select="slideshow/set">
   <xsl:variable name="slideSetPosition" select="position()" />
   <xsl:for-each select="page">
       <p><b><a>
   <xsl:attribute name="name"><xsl:value-of
select="$slideSetPosition"/>-<xsl:value-of select="position()"
/></xsl:attribute>
   <xsl:value-of select="title"/>
   </a></b></p>
     <xsl:apply-templates/>
       </xsl:for-each>
     </xsl:for-each>

I would be grateful for an answer,
Andreas




----- Original Message -----
From: "Jörg Heinicke" <joerg.heinicke@xxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, October 24, 2001 12:00 AM
Subject: Re:  problem with proper counting


> I don't know what exactly is the problem. I think you only need to match
on
> the sets and pages again, maybe with using the mode-attribute of
> <xsl:apply-templates>. Example:
>
> <xsl:template match="parent-of-set">
>     <xsl:apply-templates select="set" mode="href"/>
>     <xsl:apply-templates select="set" mode="anchor"/>
> </xsl.template>
>
> <xsl:template match="set" mode="href">
>     <xsl:for-each select="page">
>         <!-- the logic of creating the link -->
>         <a href="..."/>
>     </xsl:for-each>
> </xsl:template>
>
> <xsl:template match="set" mode="anchor">
>     <xsl:for-each select="page">
>         <!-- the same logic for creating the anchor -->
>         <a name="..."/>
>     </xsl:for-each>
> </xsl:template>
>
> Joerg
>
> ----- Original Message -----
> From: "Andreas Putscher" <andreasputscher@xxxxxx>
> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Sent: Tuesday, October 23, 2001 6:17 PM
> Subject:  problem with proper counting
>
>
> > Hi xsl-list,
> > I am not an experienced programmer and a novice in xml:
> > I have a xml-document which contains sets of pages and I would like to
> > translate it into html:
> >
> > <set id="set1">
> >   <page id="page1">some texta</page>
> >   <page id="page2">some textb</page>
> >   <page id="page3">some textc</page>
> > </set>
> >
> > <set id="set2">
> >   <page id="page4">some textd</page>
> >   <page id="page5">some texte</page>
> > </set>
> >
> > I have generated a table of contents which links to the pages (this is
> > already working):
> >
> > <h1>set1</h1>
> > <a href="#1-1">page1</a></br>
> > <a href="#1-2">page2</a></br>
> > <a href="#1-3">page3</a></br>
> >
> > <h1>set2</h1>
> > <a href="#2-1">page4</a></br>
> > <a href="#2-2">page5</a></br>
> >
> > Now I don`t know how to generate the anchors for the pages. It should
look
> > like:
> >
> > <p><a name="1-1">page1</a></p>
> > <p><a name="1-2">page2</a></p>
> > <p><a name="1-3">page3</a></p>
> > <p><a name="2-1">page4</a></p>
> > <p><a name="2-2">page5</a></p>
> >
> >
> > Do I have to use an if-clause and something with counting in here?
> > It would really help me a lot if anybody knew a solution for my problem.
> > Thanks in advance,
> > Andreas
> >
> >
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.