This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: creating a toc with links to content


Thank you thank you thank you!!! I *knew* there had to be a way to do this!



Meltem Kogelbauer wrote:

> I understands now. You are anchoring within the page. Then that's fine.
> Then you first lines on top look like
> <a>
>         <xsl:attribute name="href">#<xsl:value-of
> select="name"/></xsl:attribute>
>         <xsl:value-of select="name"/>
> </a>
>
> And in the Match="tag" template the <a> link look like this
>
> <a><xsl:attribute name="name">#<xsl:value-of select="name"/></xsl:attribute>
>
> <h3><xsl:value-of select="name"/></h3></a>
>
> Meltem
>
> -----Original Message-----
> From: Patricia Quintin [mailto:pquintin@infinitemarket.com]
> Sent: 03 May 2001 5:54 PM
> To: xsl-list@lists.mulberrytech.com
> Subject: Re: [xsl] creating a toc with links to content
>
> thanks for responding! this <a name="{name}"></a> is supposed to create a
> name
> link in the page, e.g., if you have a tag called <name> catId</name>, the
> HTML
> will say <a name="catId"></a>.
>
> The list of tag names at the top is supposed to get turned into page links,
> so
> the same catId tag would show up in the alphabetical list at the top like
> this:
> <a href="#catId">catId</a>
>
> Does this make sense?
>
> thanks again
>
> Meltem Kogelbauer wrote:
>
> > I haven't thoroughly looked at your code but when I tried the
> <xsl:attribute
> > name="name"><xsl:value-of select="name" /></xsl:attribute>
> > in the first each-loop (the first appears on top) it works quite well.
> > Comments: When you use apply-templates you do not need to use for-eash
> loop
> > for the same element.
> >
> > and this one
> >
> > <a name="{name}"></a>
> >
> > what is it supposed to do in this form?
> >
> > Meltem
> >
> > -----Original Message-----
> > From: Patricia Quintin [mailto:pquintin@infinitemarket.com]
> > Sent: 03 May 2001 2:28 PM
> > To: XSL-List@lists.mulberrytech.com
> > Subject: [xsl] creating a toc with links to content
> >
> > Hi,
> > I have an xml document with multiple items that looks like this:
> >
> > <taglib>
> >       <tag>
> >             <name>first tag</name>
> >             <info>info about this tag</info>
> >             <attribute>
> >                   <name>attribute 1</name>
> >                   <info>info about attribute 1</info>
> >             </attribute>
> >             <attribute>
> >                   <name>attribute 2</name>
> >                   <info>info about attribute 1</info>
> >             </attribute>
> >       </tag>
> >        <tag>
> >             <name>second tag</name>
> >             <info>info about this tag</info>
> >             <attribute>
> >                  <name>attribute 1</name>
> >                   <info>info about attribute 1</info>
> >             </attribute>
> >             <attribute>
> >                   <name>attribute 2</name>
> >                   <info>info about attribute 1</info>
> >             </attribute>
> >       </tag>
> > </taglib>
> >
> > I want the xsl to generate a document that creates an alphabetical list
> > of tag names at the top of the document, with each tag name being a a
> > link to the full description of the the tag further down in the
> > document.
> >
> > So far I've got the xsl creating the alphabetical list and then the
> > descriptions of each tag (also alphabetical), but the link tags aren't
> > working. Anybody got any ideas?
> >
> > here's the xsl:
> >
> > <?xml version="1.0"?>
> >
> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> > version="1.0">
> >        <xsl:template match="/">
> >
> > <html>
> >      <head>
> >          <title>xr tag library</title>
> >          <meta http-equiv="Content-Type" content="text/html;
> > charset=iso-8859-1"/>
> >      </head>
> > <body bgcolor="#FFFFFF" text="#000000">
> >
> > <h2>tag library</h2>
> > <hr/>
> >
> > <xsl:for-each select="taglib/tag" order-by="+ name"
> > xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
> >      <br/><a href="#{name}"><xsl:value-of select="name"/></a>
> > </xsl:for-each>
> >
> > <hr/>
> > <h2>tag definitions</h2>
> > <hr/>
> >
> > <xsl:template match="taglib">
> >     <xsl:for-each select="tag">
> >          <xsl:apply-templates select="tag">
> >              <xsl:sort select="name"/>
> >          </xsl:apply-templates>
> >     </xsl:for-each>
> > </xsl:template>
> >
> > <xsl:template match="tag">
> >      <xsl:for-each select="taglib/tag" order-by="+ name"
> > xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
> >           <a name="{name}"></a>
> >           <h3><xsl:value-of select="name"/></h3>
> >           <br/><b>info:</b> <xsl:value-of select="info"/>
> >           <br/><br/><i>ATTRIBUTES: </i>
> >           <xsl:for-each  select="attribute">
> >                 <br/><b><xsl:value-of select="name"/></b>
> >                 <ul>
> >                     <li>info: <xsl:value-of select="info"/></li>
> >                 </ul>
> >            </xsl:for-each>
> >           <hr/>
> >      </xsl:for-each>
> > </xsl:template>
> >
> > </body>
> > </html>
> >
> > </xsl:template>
> > </xsl:stylesheet>
> >
> > I hope I haven't given you too much/too little information. Any
> > suggestions will be greatly appreciated!
> >
> > Thanks,
> > Pat Quintin
> >
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

S/MIME Cryptographic Signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]