help needed with xlink:href

A

adMjb

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>
====================================
 
J

Joris Gillis

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>
 
A

adMjb

Hi Joris

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


Kind Regards,


Adam
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top