AW: [xsl] intra document link

Subject: AW: [xsl] intra document link
From: Nikolas.Nehmer@xxxxxxxxxxx (Nikolas Nehmer)
Date: Thu, 19 Feb 2004 09:05:12 +0100
Hm...first of all thanks for your answer. But I have a little problem
;-) your solution does not work with my setup. IE and even Mozilla
couldn't find the anchor's id destination. The anchor looks like this:
file:///path/id. I'm trying to make a dynamic approach on client/browser
side. Do I have to make a static serverside compilation/transformation?

Best regards,

|-----Ursprüngliche Nachricht-----
|Von: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-
|list@xxxxxxxxxxxxxxxxxxxxxx] Im Auftrag von G. Ken Holman
|Gesendet: Donnerstag, 19. Februar 2004 02:29
|An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
|Betreff: Re: [xsl] intra document link
|At 2004-02-18 22:50 +0100, Nikolas Nehmer wrote:
|>Hi, sorry it's me again.
|No need to apologize!
|>I'm looking for a possibility of intra document links with xhtml. For
|>better imagination a little example:
|>                 <iese.Chapter:Chapter>
|>                         <iese.Chapter:heading>Kapitel
|>For each chapter I would like to create a link, for
|>example a href to that chapter. When you klick that link the
|>visualisation for that Chapter should be displayed (e.g a table
|>Creating the visualisation is not my problem, but I don't know if
|>is way to build those intra document links! Are there any
|>any suggestions?
|Absolutely ... the designers of XSLT provided for just this.
|>I frist thought about declaring an ID attribute for any
|>chapter but I don't know if I can point to that ID by html hrefs.
|Yes, you could do that, but it is not necessary in XSLT.
|Every node in every tree created for an XSLT process (all source trees
|the stylesheet tree) is assigned a generated unique identifier.  This
|identifier is an opaque value that is used in its entirety and is
|by the processor in any fashion it wishes, provided that the identifier
|lexically matches an XML NCName.
|NCNames can, therefore, be used in HTML anchors as names and hrefs.
|You ask the processor for a node's generated identifier using the
|generate-id(nodeAddress) and every time you ask for that node's
|in a given run of a stylesheet, you get the same value back.  It may or
|not be the same value the next time you run the stylesheet, so you
|rely on any persistence so you cannot expect an identifier generated
for a
|node in one run will be the same in the next run.
|You take advantage of these generated identifiers to synthesize
|relationships, not only where there are no ID values available, but I
|learned through experience it is safest to use generated identifiers
|for nodes that have ID values (this protects from ambiguities when
|with multiple source trees with ID values in each).
|When you process your chapter table of contents, you utilize the
|generated identifier in the href= attribute.  To ensure there is
|to point to when you process your chapter, you utilize the chapter's
|generated identifier in the name= attribute.  The resulting file has
|resolved HTML hyperlinks from your TOC to your body.
|    <!--TOC-->
|    <xsl:for-each select="b:Book/b:chapters/iese.Chapter:Chapter">
|      <li>
|        <a href="{generate-id(.)}">
|          <xsl:value-of select="iese.Chapter:heading"/>
|        </a>
|      </li>
|    </xsl:for-each>
|    ...
|    <!--Body processing-->
|    <xsl:for-each select="b:Book/b:chapters/iese.Chapter:Chapter">
|      <h3>
|        <a name="{generate-id(.)}">
|          <xsl:value-of select="iese.Chapter:heading"/>
|        </a>
|      </h3>
|      <!--rest of chapter processing-->
|    </xsl:for-each>
|I hope this helps.
|............................. Ken
|p.s. I am teaching XSLT/XPath/XSL-FO in May in Bremen ... if you could
|please help spread the word to any local XML user groups, it would be
|greatly appreciated; thanks!
|Public courses: upcoming world tour of hands-on XSL training events
|Each week:    Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO
|Washington, DC: 2004-03-15            San Francisco, CA: 2004-03-22
|Hong Kong: 2004-05-17    Germany: 2004-05-24    England: 2004-06-07
|World-wide on-site corporate, government & user group XML training!
|G. Ken Holman                  mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
|Crane Softwrights Ltd. 
|Box 266, Kars, Ontario CANADA K0A-2E0     +1(613)489-0999 (F:-0995)
|Male Breast Cancer Awareness
| XSL-List info and archive:

 XSL-List info and archive:

Current Thread