[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: xpointer and xpath


Subject: Re: xpointer and xpath
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 7 Apr 2000 13:50:33 +0100 (BST)


<!DOCTYPE x [
<!ELEMENT y ANY >
<!ATTLIST y id ID #IMPLIED>
]>
<x>
<y/>
<y/>
<y id="ID1"/>
<a hh="22"/>
<a hh="33"/>
<y id="ID2">
  <zz/>
</y>
<ss/>
<y id="ID3">abcdefghij</y>
</x>





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

<xsl:output method="xml" indent="yes"/>


<xsl:template match="/">

2.1 range based on element IDs
<xsl:copy-of select=
  "id('ID1')|
   id('ID1')/following::node()[./following::*[@id='ID2']]|
   id('ID2')"/>

 2.3 range based on character offsets 
<xsl:copy-of select="substring(id('ID3'),2,5)"/>

</xsl:template>

</xsl:stylesheet>



<?xml version="1.0" encoding="utf-8"?>


2.1 range based on element IDs
<y id="ID1"/>
<a hh="22"/>
<a hh="33"/>
<y id="ID2">
  <zz/>
</y>

 2.3 range based on character offsets 
bcdef


David


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread