Jump to content

XML / XLink / XPointer?


Recommended Posts

I don't understand how to use XLink to create a hyperlink on a single word. Example:

<news><topic>the topic</topic><body>heres some information about our topic. for more, click here.</body></news>

i've read a few tutorials on xlink and they show how to take a whole node and make it a link...but nothing is clear on making a single word in that node a link.in the example above i would like the word "here" at the end to link to an external url. i've read a little on xpointer and thought maybe that's what i need to use also....but i'm just not sure. any help would be appreciated.

Link to post
Share on other sites

for fun...you can write a link like this:

<a href="THELINK.COM"> click here </a>

(I hope I didn't have a typo)

Link to post
Share on other sites

XLink and XPointer can help you target the certain word or node, but not to define that word as a link to a target.In other words, a link may target the word "here" without that word having it's own node with(out) ID. However, links can only be defined on nodes. And not any nodes either. Elements only, scince XLink uses attributes and XPointer is part of those same attributes.

Link to post
Share on other sites
XLink and XPointer can help you target the certain word or node, but not to define that word as a link to a target.In other words, a link may target the word "here" without that word having it's own node with(out) ID. However, links can only be defined on nodes. And not any nodes either. Elements only, scince XLink uses attributes and XPointer is part of those same attributes.
is what i want to do even possible? i can't imagine not being able to use a "hyperlink" with xml.
Link to post
Share on other sites

It is exactly my point that what you want is not possible. In order to create a link in an XML document, you need to define an element to carry it and that's it. You can't define part of the text as a link. But you can target a text with a link.

Link to post
Share on other sites
But you can do what I said...I've done it before. As long as you don't use CDATA
What you did was to define a raw piece of code, that when transformed with XSLT results in an HTML link. But that's not XML link on it's own. Just a text, that get's specially transformed.
Link to post
Share on other sites
  • 2 years later...

Hi All,I am new to all this. I am trying to link one xml file to another. Here's my code. It just dosent work.<!-- DEFINING XLINK NAMESPACE --><anydoc xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple"> (anydoc is the root element containing dochead,sec*).<sec><head>Section Heading</head><p>Some text <it xlink:href="note.xml" xlink:show="new">Linking text</it>Rest of the text ....</p></sec>Although the file displays fine in the browser, the link does not work and while parsing the error "character ':' not allowed in attribute specification list" is shown in both these lines.Do we have to use xpointer with xlink to make it work? What about parsing errors?Please help.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...