|
Subject:
|
Navigating table of content in XSL
|
|
Posted By:
|
trufla
|
Post Date:
|
5/15/2006 6:32:53 PM
|
I have this code to create a wap site from one card.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<wml>
<card id="Stories" title="Dingley Dell News">
<p>
<big><b>News Stories</b></big>
</p>
<p><img src="mobileImages/phone.wbmp" alt="mobile phone" /></p>
<p><a href="index.html">home</a></p>
<!-- A -->
<xsl:apply-templates mode="toc"/>
<!-- B -->
<xsl:apply-templates/>
</card>
</wml>
</xsl:template>
<!-- C -->
<xsl:template match="Article" mode="toc">
<a href="#{ArticleTitle}"><xsl:value-of select="ArticleTitle"/></a><br/>
</xsl:template>
<!-- D -->
<xsl:template match="Article">
<div>
<h2><a name="{ArticleTitle}"><xsl:value-of select="ArticleTitle"/></a></h2>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="ArticleTitle"/>
<xsl:template match="ArticleEntry">
<p><a href="TransXML_Mobile.php">back to story links</a></p>
<p><xsl:apply-templates/></p>
</xsl:template>
</xsl:transform>
The problem is that I want to be able to click the link "back to story links" to go back to the top of the card.
But when I navigate to a story, if I want to return to the top of the card, I should be able to click the link "back to story links", but it cannot be highlighted and clicked.
Anyone have any ideas how to solve this?
Cheers!
|
|
Reply By:
|
mhkay
|
Reply Date:
|
5/16/2006 3:24:23 AM
|
I think it's always a good idea to split these problems into two. First work out what HTML you want to generate, then work out what XSLT is needed to produce it. From your description of the problem, it's not clear whether you know what HTML you are trying to generate or not. Don't start to tackle the XSLT coding until you know what its output (that is, the HTML) should be.
Michael Kay http://www.saxonica.com/ Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|
Reply By:
|
trufla
|
Reply Date:
|
5/16/2006 10:08:33 AM
|
Hiya!
I just wanted to produce this:
<wml>
<card id="Stories" title="The title">
<p>News Stories</p>
<p>Table of contents - <a href="#Story1">link 1</a></p>
<p>Table of contents - <a href="#Story2">link 2</a></p>
<p>Table of contents - and so on</p>
<p id="Story1">Story Content</p>
<a href="#Stories">back to top</a>
</card>
</wml>
But when I jump to say link 20 the 'back to top' link does not hightlight.
Cannot you not use anchors in one card?
|