xsl-list
[Top] [All Lists]

Re: [xsl] Finding referenced / refered element in any level within a common parent element

2006-10-10 03:15:17

If I understand you just want to know which SubSection the reference and
the figure are in and  test if they are the same.

So first key on the figures

<xsl:key name="fig" match="Figure" use="@id"/>

Then 

<xsl:template match="a[(_at_)type="figure"]"
  <xsl:variable name="thissec" select="ancestor::SubSection[1]/@id"/>
  <xsl:variable name="figsec"
          select="key('fig',@href)/ancestor::SubSection[1]/@id"/>
 <xsl:choose>
  <xsl:when test="$thissec=$figsec">
   <a href="#{(_at_)href}">
    <xsl:apply-templates/>
   </a>
  </xsl:when>
  <xsl:otherwise>
   Could link to other doc
   <a href="{$figsec}(_dot_)html#{(_at_)href}">
    <xsl:apply-templates/>
   </a>
  or just make text
    <xsl:apply-templates/>
 </xsl:otherwise>
 </xsl:choose>
</xsl:template>

David


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>