Editing rel-links for HTML output
Posted: Fri Mar 06, 2009 12:51 am
Hello all,
In customizing our single page HTML output in DITA we wanted to remove the child links from being under each topic head that had child nodes and all the links that point back to the top, so we changed "NOPARENTLINK" to yes (on line 17) in rel-links.xsl and commented out the "ul-child-links" template call. However now we would like to consider a hybrid format where you can have parent links (links back to the top) but only after each major section (at the bottom of the root node topics only, after all of its children). Is there a way to do this in the rel-links.xsl file?
Also I have a few other curiosities about the rel-links.xsl file while I'm asking about it. For the matching in the templates, such as at the top of the ul-child-links template, what is the expression "descendant::*[contains(@class, ' topic/link ')]" actually matching? Where does the "/link" part come from as a child of a topic? Is this something inserted by the rel-links xsl somewhere else in the transformation? Also why is it that the ul-child-links section specifically that makes the links disappear from under the topic headings rather than the "ol-links", "reference-links", or other templates? Looking at the code I'm trying to get the overall picture of what it is doing, but I'm getting mired in the details.
Finally, for the "NOPARENTLINK" check, what do the conditions here actually check? (I will place hash marks in front of the lines in question):
Of particular interest to me is the @href attribute it tries to match, where does that come from?
Ultimately all I want to do it put a link at the bottom of each major section back to the top, but I'd like to understand some more of rel-links inner workings as well. Sorry to throw so much out there at once. I hope this is digestable.
Thanks,
Josh
In customizing our single page HTML output in DITA we wanted to remove the child links from being under each topic head that had child nodes and all the links that point back to the top, so we changed "NOPARENTLINK" to yes (on line 17) in rel-links.xsl and commented out the "ul-child-links" template call. However now we would like to consider a hybrid format where you can have parent links (links back to the top) but only after each major section (at the bottom of the root node topics only, after all of its children). Is there a way to do this in the rel-links.xsl file?
Also I have a few other curiosities about the rel-links.xsl file while I'm asking about it. For the matching in the templates, such as at the top of the ul-child-links template, what is the expression "descendant::*[contains(@class, ' topic/link ')]" actually matching? Where does the "/link" part come from as a child of a topic? Is this something inserted by the rel-links xsl somewhere else in the transformation? Also why is it that the ul-child-links section specifically that makes the links disappear from under the topic headings rather than the "ol-links", "reference-links", or other templates? Looking at the code I'm trying to get the overall picture of what it is doing, but I'm getting mired in the details.
Finally, for the "NOPARENTLINK" check, what do the conditions here actually check? (I will place hash marks in front of the lines in question):
Code: Select all
<xsl:if test="$NOPARENTLINK='no'">
<xsl:choose>
### <xsl:when test="*[@href][@role='parent']">
### <xsl:for-each select="*[@href][@role='parent']">
<div class="parentlink"><xsl:apply-templates select="."/></div><xsl:value-of select="$newline"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
### <xsl:for-each select="*[@href][@role='ancestor'][last()]">
<div class="parentlink"><xsl:call-template name="parentlink"/></div><xsl:value-of select="$newline"/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
Ultimately all I want to do it put a link at the bottom of each major section back to the top, but I'd like to understand some more of rel-links inner workings as well. Sorry to throw so much out there at once. I hope this is digestable.
Thanks,
Josh