[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

linking in XML


Subject: linking in XML
From: Knut Alboldt <alboldt@xxxxxxx>
Date: Wed, 04 Oct 2000 12:30:59 +0200

Hi !

If I want to link from one XML-file to another (using IE5.5 + MSXML2) 
including anchors I tried the following:

file1:

<?xml ...>

  <section id="test1" linkto="file2.xml#test2">
  any text
  </section>

file2:

<?xml ...>

  <section id="test2">
    text linked to
  </section>

with the following xsl-script I translate both into a <a>-tag 
(using attribs href="file2.xml#test2" for file1 and name="test2" for
file2):

<xsl:stylesheet>
  ...
  <xsl:template match="section">
    <div class="section">
      <xsl:if test=".[@id]">
        <!-- this should create the anchor to link to -->
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="@id"/>
          </xsl:attribute>
        </a>
      </xsl:if>
      <xsl:if test=".[@linkto]">
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="@linkto"/>
          </xsl:attribute>
          link to <xsl:value-of select="@linkto"/>
        </a>
      </xsl:if>
      <xsl:apply-templates/>
    </div>
  </xsl:template>

 ...

The result is not what I exspected: the link will display the xml-file
(the URL-line will
also dispolay the anchor: "../file2.xml#test2" , but will not jump to
the corresponding anchor #test2

can somebody help me ?


Thanks 

Knut


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread