help needed with xlink:href

Discussion in 'XML' started by adMjb, Jun 1, 2006.

  1. adMjb

    adMjb Guest

    Hi

    Any help would be fantastic

    I have a simple problem but I cant work it out... DOHH...., this is my
    XML:

    <?xml version="1.0" encoding="UTF-8" ?>
    <?xml-stylesheet type="text/css" href="BSI%20Test.css"?>
    <document xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:html="http://www.w3.org/HTML/1998/html4" xml:lang="en-US"
    style="\-ilx-style-update: none; widows: 0; orphans: 0;
    word-break-inside: normal; \-ilx-endnote-numbering-policy: continuous;
    \-ilx-endnote-position: sectionbottom; \-ilx-endnote-style-type:
    decimal; \-ilx-footnote-numbering-policy: continuous;
    \-ilx-footnote-position: documentbottom; \-ilx-footnote-style-type:
    decimal;\-ilx-block-border-mode: merge;">

    <part>
    <list>
    <endnote> If this works I'll be amazed <link
    xlink:href="http://www.weblink.com">
    <inline class="Hyperlink">ONE</inline>
    </link>
    </endnote>

    <endnote> If this works I'll be amazed <link
    xlink:href="http://www.weblink.com">
    <inline class="Hyperlink">TWO</inline>
    </link>
    </endnote>

    <endnote> If this works I'll be amazed <link
    xlink:href="http://www.weblink.com">
    <inline class="Hyperlink">THREE</inline>
    </link>
    </endnote>
    </list>
    </part>
    </document>
    =========================================
    And this my XSL:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    exclude-result-prefixes="xlink">
    <xsl:eek:utput method="xml" version="1.0" encoding="UTF-16"
    indent="no"/>
    <xsl:template match="document">
    <root>
    <end>
    <xsl:for-each select="//endnote">
    <endNoteText>
    <endNum>
    <xsl:number level="any" format="1"/>
    </endNum>
    <xsl:value-of select="."/>
    </endNoteText>
    </xsl:for-each>
    </end>
    </root>
    </xsl:template>
    </xsl:stylesheet>

    =====================================

    But my output is wrong, I want the weblink to be part of the text
    somthing like this:

    <?xml version="1.0" encoding="UTF-16"?>
    <root>
    <end>
    <endNoteText><endNum>1</endNum> If this works I'll be amazed <link
    href="http://www.weblink.com">ONE</link> </endNoteText>
    <endNoteText><endNum>2</endNum> If this works I'll be amazed <link
    href="http://www.weblink.com">TWO</link> </endNoteText>
    <endNoteText><endNum>3</endNum> If this works I'll be amazed <link
    href="http://www.weblink.com">THREE</link> </endNoteText>
    </end>
    </root>
    ====================================
     
    adMjb, Jun 1, 2006
    #1
    1. Advertising

  2. adMjb

    Joris Gillis Guest

    On Thu, 01 Jun 2006 14:10:22 +0200, adMjb <> wrote:

    > But my output is wrong, I want the weblink to be part of the text
    > somthing like this:


    If you want to output elements as well, you shouldn't be using
    'xsl:value-of': it only returns text.
    Rather, use 'xsl:apply-templates' as much as you can:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    exclude-result-prefixes="xlink">
    <xsl:eek:utput method="xml" version="1.0" encoding="UTF-16"
    indent="no"/>
    <xsl:template match="document">
    <root>
    <end>
    <xsl:for-each select="//endnote">
    <endNoteText>
    <endNum>
    <xsl:number level="any" format="1"/>
    </endNum>
    <xsl:apply-templates />
    </endNoteText>
    </xsl:for-each>
    </end>
    </root>
    </xsl:template>

    <xsl:template match="link">
    <link href="{@xlink:href}">
    <xsl:apply-templates />
    </link>
    </xsl:template>


    </xsl:stylesheet>


    --
    Joris Gillis (http://users.telenet.be/root-jg/me.html)
    Veni, vidi, wiki (http://www.wikipedia.org)
     
    Joris Gillis, Jun 2, 2006
    #2
    1. Advertising

  3. adMjb

    adMjb Guest

    Hi Joris

    Many thanks for your help, that worked, fantastic, THANK YOU!!!!!


    Kind Regards,


    Adam



    Joris Gillis wrote:
    > On Thu, 01 Jun 2006 14:10:22 +0200, adMjb <> wrote:
    >
    > > But my output is wrong, I want the weblink to be part of the text
    > > somthing like this:

    >
    > If you want to output elements as well, you shouldn't be using
    > 'xsl:value-of': it only returns text.
    > Rather, use 'xsl:apply-templates' as much as you can:
    >
    > <?xml version="1.0" encoding="UTF-8"?>
    > <xsl:stylesheet version="1.0"
    > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    > xmlns:xlink="http://www.w3.org/1999/xlink"
    > exclude-result-prefixes="xlink">
    > <xsl:eek:utput method="xml" version="1.0" encoding="UTF-16"
    > indent="no"/>
    > <xsl:template match="document">
    > <root>
    > <end>
    > <xsl:for-each select="//endnote">
    > <endNoteText>
    > <endNum>
    > <xsl:number level="any" format="1"/>
    > </endNum>
    > <xsl:apply-templates />
    > </endNoteText>
    > </xsl:for-each>
    > </end>
    > </root>
    > </xsl:template>
    >
    > <xsl:template match="link">
    > <link href="{@xlink:href}">
    > <xsl:apply-templates />
    > </link>
    > </xsl:template>
    >
    >
    > </xsl:stylesheet>
    >
    >
    > --
    > Joris Gillis (http://users.telenet.be/root-jg/me.html)
    > Veni, vidi, wiki (http://www.wikipedia.org)
     
    adMjb, Jun 2, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bernd Oninger
    Replies:
    1
    Views:
    564
    Henry S. Thompson
    Jun 30, 2004
  2. CRON
    Replies:
    24
    Views:
    203,911
    Adrienne Boswell
    Jun 20, 2006
  3. Soren Vejrum
    Replies:
    4
    Views:
    771
    Lasse Reichstein Nielsen
    Jul 5, 2003
  4. saiho.yuen
    Replies:
    3
    Views:
    556
    kaeli
    Sep 14, 2004
  5. Lance Dyas
    Replies:
    4
    Views:
    117
    Randy Webb
    Oct 6, 2005
Loading...

Share This Page