[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Processing Select Patterns in XSL...
One thing that is slightly confusing with select patterns is selecting elements containing parent anchors. For example, say I have: <xsl:template match="book"> <fo:block> <xsl:process select="../../../heading"/> </fo:block> </xsl:template> >From what I understand, this would say first go to the third parent node of the current node and select all heading elements and process them. This would seem to be an error since another template may already have processed these heading elements. Match patterns seem to be pretty straightforward in how you use them as all you need to really do is start at the right-most pattern component and work left. If everything matches up then finally make sure that the anchor matches up with the parent of the node that matched the left most pattern. If everything still holds, then apply the template rule to this particular element in the source tree when spitting out the result tree. Now select patterns it seems from first glance that you would instead start from the current node and work left to right instead of right to left as in the case of match patterns. Essentially, you would start from the current node and recursively process all of the descendants that end up matching the ancestry pattern from left to right. For ancestry patterns that do not contain an immediate ancestor operator this process would be rather cheap. But in the above example, what do you do when relative or absolute anchors withing select patterns anchor a node which is an ancestor of the current node in context. In this case, it seems as if you can have multiple template rules acting on the same elements. Another question is what to do with Absolute Anchors. I would think that for select patterns it would not make sense for this to be allowed as the entire template match then has nothing to do with the actual processing. For example if I match a particular element and then select a set of nodes who are anchored at the root, this would be like doing global processing independent of the match argument. I am sure many of these questions are things which I do not understand due to my relative inexperience with stylesheet languages (most people are probably also in this boat) and the fact that the most recent spec is very much incomplete, but it would be nice to know if these are errors overlooked in the spec, or just my complete misunderstandings on these issues. Regards, Tyler xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ To (un)subscribe, mailto:majordomo@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
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
|