Subject: XPointers and XSL Patterns From: "James Tauber" <jtauber@xxxxxxxxxxx> Date: Wed, 2 Sep 1998 11:59:44 +0800 |
This is a very rough attempt to cast the first half of the examples from the current WD-xptr into XSL patterns along with some brief notes on how XSL patterns would need to be expanded. If I get some responses from this, I can turn it into a more developed proposal. child(2,SECTION).child(1,SUBSECTION) --> /SECTION[2]/SUBSECTION[1] note: introduces into XSL pattern instance numbering. This could be done as above or perhaps as /SECTION[instance(2)]/SUBSECTION[instance(1)] I've used the former in this document descendant(-1,EXAMPLE) --> //EXAMPLE[-1] child(5) --> /*[5] child(1,#element,TARGET,*) --> /#element[1,attribute(TARGET)] note: do we need #element? This could be written as /*[1,attribute(TARGET)] I won't treat #element different from * below Also, I'm not sure whether the suggested XSL pattern above would mean (following the XPointer) the first child with a TARGET attribute, or rather the first child if it has a TARGET attribute. This is a subtle but important distinction. I'll assume it is taken as the XPointer interpretation in this document (but I actually think the other interpretation is more natural for XSL). Perhaps this is where instance() comes in. child(1,#element,N,2).(1,#element,N,1) --> /*[1,attribute(N)='2']/*[1,attibute(N)='1'] child(1,FS,RESP,#IMPLIED) --> /FS[1,attribute(RESP)=#IMPLIED] note: does XSL currently have an equivalent to #IMPLIED here? html(Sec3.2) root().descendant(1,A,NAME,"Sec3.2") --> //A[1,attribute(NAME)="Sec3.2"] id(a23).descendant(2,TERM,LANG,DE) --> id(a23)//TERM[2,attribute(LANG)=DE] note: does XSL distinguish literal and normalized attribute value matching? this seems to be an open issue. root().descendant(-1,NOTE) --> //NOTE[-1] note: should negative instance numbers be used, or some other mechanism? ancestor(1,#element,N,1).(1,DIV) <!-- I'll infer existence of current node --> note: In XSL terms, you've got to think of this as the DIV element whose first descendent is the first element ancestor of the current note with attribute N = 1. Whew! So we need descendant as well as child qualifiers along with instance numbers on both descedant and ancestor: DIV[descendant(*[1,./ancestor(*[1,attribute(N)='1'])])] Yuk! Does this have implications for whether XPointers and XSL patterns should use the same syntax? I don't even think I've got it right. Perhaps there's a much easier way. id(a23).preceding(5,#element) note: this also needs to be rethought, in this case as the element with the 5th following node having id(a23) *[following(5,id(a23))] id(a23).preceding(all) *[following(id(a23))] id(a23).following(2,#pi) note: again, the thinking has to be reversed. The addressing of PIs with XSL patterns is an open issue in the WD. #pi[2,preceding] is there a way around this thinking reversal? Any comments welcome James -- James Tauber / jtauber@xxxxxxxxxxx http://www.jtauber.com/ Lecturer and Associate Researcher Electronic Commerce Network ( http://www.xmlinfo.com/ Curtin Business School ( http://www.xmlsoftware.com/ Perth, Western Australia ( http://www.schema.net/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Just Not Getting It, carlton . e . noles | Thread | Re: XPointers and XSL Patterns, James Clark |
Re: Just Not Getting It, Paul Prescod | Date | Re: XPointers and XSL Patterns, James Clark |
Month |