Re: Viewport and nested selected nodes


Alex Milowski wrote:
> So, in XSLT, a select attribute with a value of "//h:div" would return
> all the "h:div" elements in the document.  In our case, we're going
> to return only the outermost elements.  As such, it isn't the same thing
> as a select pattern in XSLT.  Given that, it seems like we're going
> to confuse users who come from XSLT-land.

There's no such thing as a "select pattern" in XSLT; in XSLT, a 'select' 
attribute always holds an XPath expression, and 'match' is the usual 
attribute for an XSLT pattern.

The 'select' for computed ports (and the input for for-each *is* a 
computed port) must identify all nodes in the document, not just the 
outermost ones. My use case is creating multi-page HTML output in which 
every section (including sections-within-sections) has a separate page. 
I want to do this with:

     <p:input port="section" ... select="//section" />
     <p:output port="result" step="toHTML" source="result" />
     <p:step name="toHTML" type="p:xslt">
       <p:input port="document" source="section" />
       <p:input port="stylesheet" href="section2html.xsl" />

The 'select' for viewport doesn't behave in the same way as it does with 
computed ports (and for-each) -- it only identifies outermost nodes -- 
and therefore should be called something different from the 'select' for 
computed ports. (This is part of my argument about putting these 
attributes on the <p:viewport> rather than on a <p:input> inside.)

> Note that a match pattern doesn't suffer from that confusion because
> the "apply" semantics will be very similar to XSLT's template matching.

But you *select* the nodes to which to apply templates using an XPath 
expression. The match pattern on a template just helps you decide which 
template to use to process them. We don't have a template-matching model 
for processing different kinds of nodes in XProc, so I don't think that 
the XSLT model applies.


Jeni Tennison

Received on Wednesday, 25 October 2006 08:43:17 UTC