What do you call a singer formerly of a 70's female band? Xpointer Sister
By now you'll be familiar with our innovative 'Hello World' theme.
But here we're going to delight you by combining both of the previous pages into
one bi-lingual greeting...
<idoc> <comment>
***************************
DPML Tutorial - App3
Copy, Response, Xpointer
***************************
</comment> <seq> <instr> <type>copy</type> <operand>hello.xml</operand> <target>this:response</target> </instr> <instr> <type>copy</type> <operand>bonjour.xml#xpointer(/html/body/h1)</operand> <target>this:response#xpointer(/html/body/i)</target> </instr> <instr> <type>cast</type> <operand>this:response</operand> <operator> <cast> <mimetype>text/html</mimetype> </cast> </operator> <target>this:response</target> </instr> </seq> </idoc>
Try this application here
This application is a variation on the previous two. The first instruction is exactly the same as
in the first application. It copies hello.xml to this:response .
The second instruction introduces the use of URI references with xpointers. Xpointers are a standard that
allow Xpath references to be incorporated in URI's to specify a location within an XML resource.
The <operand> URI has an xpointer to the <h1> element containing 'Bonjour Tout Les Mondes' in the
bonjour.xml document. The <target> URI has an xpointer to a part of the this:response document.
In this example this:response already contains the result of the first instruction ie
hello.xml the second instruction is then placed at the xpath /html/body/i which has the result of replacing
the italicised message seen in the first application with the French greeting.
With xpointer we can source document fragments from any location in the operand and place them at any location within the
response document, provided of course that the xpath location exists.
|