By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,771 Members | 1,709 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,771 IT Pros & Developers. It's quick & easy.

help needed with xlink:href

P: n/a
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:output 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>
====================================

Jun 1 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Thu, 01 Jun 2006 14:10:22 +0200, adMjb <ad***********@gmail.com> 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:output 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)
Jun 2 '06 #2

P: n/a
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 <ad***********@gmail.com> 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:output 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)


Jun 2 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.