This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

linking in XML


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]