|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Creating Forward/Backward HTML links from multi-fi
At 2004-01-24 10:11 -0700, Randolph Kahle wrote:
I am using XSL to translate a set of XML documents into a corresponding set of HTML documents. I am stuck trying to figure out how to create <a > ... </a> links in HTML that display forward and backward pointers through the web pages. You will still need a unique identifier for each topic, so I'll assume you'll move the <file> element one level higher to be a child of <topic>. When you are in the template rule for a topic, you can test just as you asked in prose: <xsl:if test="preceding-sibling::topic">
<a href="{preceding-sibling::topic[1]/file}.htm">
<xsl:value-of select="preceding-sibling::topic[1]/title"/>
</a>
</xsl:if>... and the mirror using following-sibling:: axis for the next. Note that the [1] predicate (when in a step) addresses the closest in that direction, because the axes are proximity ordered. I hope this helps. .............................. Ken p.s. when I do this with my course presentation slides, I use an ID-typed attribute for the base of the filename since that guarantees uniqueness across the XML document; if you inadvertently name two topics with the same file, you will get overwrite without getting any errors; but if you add an ID-typed attribute to topic and you validate the document, the validation process will flag duplicates before you start creating any files. Alternatively, you could use a key table: <xsl:key name="files" match="topic/file" use="."/> ... then when you go to produce each of the actual files: <xsl:if test="count(key('files',file))>1">
<xsl:message terminate="yes">Duplicate filename!</xsl:message>
</xsl:if>
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








