473,322 Members | 1,714 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,322 software developers and data experts.

xlink and xpointer

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
BBBB
DDDD

In the xlst I have tried changing the xsl:for-each to see if
I could figure out how to address the <test><Common><Param>
With no success.
Maybe the xlink I have done is wrong, or even what I like
to achieve is not possible at all.
The xml file I have is like this.

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="testxlink.xslt"?>
<test xmlns:xlink="http://www.w3.org/1999/xlink">
<Common id="pre">
<Param>AAAA</Param>
<Param>BBBB</Param>
</Common>

<Element>
<common xlink:type="simple" xlink:href="#pre"/>
<Param>CCCC</Param>
</Element>
<Element>
<common xlink:type="simple" xlink:href="#pre"/>
<Param>DDDD</Param>
</Element>
</test>
The xslt
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<xsl:for-each select="test/Element">
<xsl:for-each select="Param">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


Feb 10 '07 #1
4 2851
If you want that output, you have to have logic that explicitly expands
the XLink -- either in something that processes your file before the
stylesheet sees it, or in the stylesheet itself. You haven't provided
the latter, and apparently nothing in your system is providing the former.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Feb 10 '07 #2
Joe Kesselman wrote:
If you want that output, you have to have logic that explicitly expands
the XLink -- either in something that processes your file before the
stylesheet sees it, or in the stylesheet itself. You haven't provided
the latter, and apparently nothing in your system is providing the former.
I see.

I was hoping the xslt processor should expand the xlink (automatically),
and then it was only a mather of seeing xml elements.
Is there any xslt processor who will do the expansion automatically.

/Martin
Feb 10 '07 #3
* Martin wrote in comp.text.xml:
>Is there any xslt processor who will do the expansion automatically.
No, for what you want XInclude http://www.w3.org/TR/xinclude/ is better
suited. If you want to do this in XSLT you could just use the substring-
after function to get the part after the # in the xlink:href and simply
find the corresponding element and apply any transformation to that, or
simply copy it using xsl:copy-of.
--
Björn Höhrmann · mailto:bj****@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Feb 10 '07 #4
Bjoern Hoehrmann wrote:
* Martin wrote in comp.text.xml:
>>Is there any xslt processor who will do the expansion automatically.

No, for what you want XInclude http://www.w3.org/TR/xinclude/ is better
suited. If you want to do this in XSLT you could just use the substring-
after function to get the part after the # in the xlink:href and simply
find the corresponding element and apply any transformation to that, or
simply copy it using xsl:copy-of.
XInclude fantastic.

I rewrote the xml and now it works as I like.

many thanks
/Martin
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="testxlink.xslt"?>
<test xmlns:xi="http://www.w3.org/2001/XInclude">
<Common>
<Param>AAAA</Param>
<Param>BBBB</Param>
</Common>

<Element>
<xi:include href="#xpointer(//Common/Param)"/>
<Param>CCCC</Param>
</Element>
<Element>
<xi:include href="#xpointer(//Common/Param)"/>
<Param>DDDD</Param>
</Element>
</test>

Feb 11 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DV | last post by:
Hello, can anyone tell me or point me to somewhere what the exact differences (in terms of when would I use what) between XPath, XLink, XPointer and DOM are? Does it require special software...
1
by: a | last post by:
I'd like to associate (link elements in) a linkbase (xml) file with (elements in) an instance document (xml). I've never seen an example of how to do this. Anyone know how to do this in .NET? ...
2
by: Pascal Schmitt | last post by:
Hello! Is there an Implementation of XPointer for .NET which supports range-to? (Or if not: how difficult is it to build it yourself?) -- Pascal Schmitt
0
by: shaun | last post by:
Can anyone clarify if these are true and perhaps add to the list of XPointer supported parsers/transformers: For parsers: * Xerces will allow elements to be accessed if they have an xml:id...
0
by: Henry S. Thompson | last post by:
W3C is pleased to announce the public launch of the XPointer Schemes Registry: http://www.w3.org/2005/04/xpointer-schemes/ The XPointer Recommendation reserved all simple (unprefixed) XPointer...
1
by: Daniel | last post by:
Microsoft support for XPointer and XLink what micrsoft technologies support XPointer and XLink?
0
by: moonty | last post by:
Is it possible to have a xpointer attribute inside a xml file called from a xinclude attribute. eg: FileA.xml <xi:include href="FileB.xml" /> FileB.xml <xi:include href="FileC.xml"...
2
by: Giacomino | last post by:
Let's suppose I want a document like this: <tree> <node> <nodeChildren> <node... </node> ... <nodeSelection selected="..."/> </node> ....
0
by: ab.angadbhat | last post by:
hi, I have an element in the xml file which has xlink:href ="xyz.xml" as an attribute. I am using xpointer to point to only 2nd <Uelement of the xyz.xml file and so i am doing:- xlink:href...
3
by: Robert Jones | last post by:
Is there a browser or even just a parser that fully supports and implements xlink and xpointer?
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.