|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Pattern question: first child of first descendant
>>match="entry[. is >>ancestor::table[1]/descendant::entry[1]]/*[self::title|self::para][1]" > >This will match the first title or para child of a first entry >descendant of a table, but if you have > ><entry> > <label/> > <title/> > <para/> ></entry> > >the title will be matched. > >I think the spec needs a bit of clarification. :-) Sorry for being imprecise, the intent is to match the first title or para in a cell, whichever comes first. It doesn't matter whether there are other elements before it (label in your example). But actually, that part was not the most difficult part - I had the difficulties in matching only the first descendant in document order of some other element. I'm not answering to the many helpful posts on this individually. Andrew's link on "//" was very interesting (the gotcha would have resp. has got me for sure). I'll try to summarize the idea behind the solution: 1. Patterns are limited. If you cannot do it directly, shove the logic into predicates. 2. In the predicate, use the ancestor axis to "go back" to the element you wanted to start from originally, then formulate your path as you would have done without patterns' limitations and check for node identity on the target. Hope I got that sufficiently right, though it reads not much clearer :- ( Another try: Instead of match="anchor/unsupported_pathspec_to/target" use match="target[. is pathspec_to/anchor/unsupported_pathspec_to/target]" -Christian
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








