Print

Print


Yeah, I don't think any of the cookbook style sheets output anchor tags based on the ID attribute - it's part of being able to link, and since they didn't implement linking elements, they didn't do the anchors either.

Anyway, it's pretty easy.  You just have to add code to check whether a given element has an ID, and if it does, output an anchor.  If you're putting IDs in your c0# elements, the easiest place to add it is in the component-did template, which is used by all the c0#s (search for <xsl:template name="component-did">).  Like so:

      <!-- If the parent component (c0-whatever) has an ID, then create the HTML anchor for it -->
                        <xsl:if test="../@id">
                                    <a id="{../@id}"></a>
                        </xsl:if>

I put ours right at the top of the component-did template, right after the unitid handling and before the unittitle handling.

If you want to use the ID attribute with other elements than the c0#s you'll have to add the code to those element sections as well.  If you find yourself adding it in lots of places then it's probably a better idea to put the ID handling code in a single named template (e.g. <xsl:template name="check-for-id">) and then just call the template from all those places; that way if you ever need to make a change to the ID handling you'll only have to do it in one place.

Michele

From: Encoded Archival Description List [mailto:[log in to unmask]] On Behalf Of Nathan Tallman
Sent: Wednesday, April 07, 2010 1:40 PM
To: [log in to unmask]
Subject: Converting Tag IDs into Anchor Tags

I think its an issue with my stylesheet (eadcbs6 and dsc6), but named ids in the EAD file (ex. <item id="ref1">) are not showing up as anchor tags in a the transformed xml document as I thought they would.  Thanks to some code Michele sent me last week, the hyperlinks are transforming correctly, but if it's pointing to an internal link, it doesn't go anywhere in the transformed file.

Sorry to keep pestering the list with stylesheet questions :)  I hope to attend the SAA workshop on them at some point this year.

Thanks,
Nathan