473,395 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

help needed with xlink:href

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
2 1945
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mike | last post by:
I need to have some links within an xml document to external pages. I have tried with the below xml and xsl documents(the proposed link has a tag called link under paragraph): XML:...
1
by: Bernd Oninger | last post by:
As far as I know one could use other xsd schemas with the import and the xlink feature. What are the differences (beside the syntax)? Bernd
5
by: Adam | last post by:
Hi, Me very confused. I have some XML that I want to convert to a more basic XML. I have put an example of what I have and what I want, I have used XSL to convert XML to HTML, but never this way. ...
1
by: Lothar Lemnitzer | last post by:
Dear fellows, I have a problem with matching namespaces in an XML document and an XSLT stylesheet (at least I think that this is the source of trouble). My XML document looks like this: 1...
4
by: Lance Dyas | last post by:
I have managed to get the xml to load using the xmlHTTPrequest... (inspite of premature readyState 4) the problem now arises in Safari alone... var thelink = node.getAttribute("xlink:href") ...
4
by: jvanulden | last post by:
Hello all, I am having difficulty figuring out how to create an XmlElement and giving it an attribute that requires a namespace. Here is what I have so far which throws an exception because you...
4
by: Martin | last post by:
Hello I'm trying to learn xlink/xpointer (with no success so far :-( I would like to produce the following output. AAAA BBBB CCCC AAAA
1
by: kaye80 | last post by:
I have an XML and XSL document. I am trying to incorporate hyperlinks throughout the XML document. I have read many of the related posts on this and other forums but I can't seem to get it right. ...
9
by: jayvi | last post by:
I used this code inside of a javascript file to switch out an 'add to cart' button: var addDisplay = document.getElementById('cart-add'); addDisplay.innerHTML = "<a class='item_add'...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.