This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: xpointer and xpath




<!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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]