xsl-list
[Top] [All Lists]

RE: use-when attribute?

2004-12-18 07:16:13
In layperson's terms (because I may hack the technical 
terminology!), I 
need to get a list of all the citation references in a 
document to use 
for processing (querying a database, etc.), but I want the specific 
form those citations are in to be flexible.

Using template rules would work well if you can process each citation
reference as you reach it during traversal of the document. If you want to
extract all the citation references, then do it the way you originally
suggested, using a variable.

In XPath 2.0 you can use the append operator "," instead of the union
operator "|" if there's no requirement to eliminate duplicates or do a sort.
But in this case I doubt if it will make any difference. I'd be surprised if
using keys makes sense.

What would make a difference is to avoid searching for references that can't
appear in the current document. That is, you could do something like:

if (/doctype1) then //@citation1 else (),
if (/doctype2) then //@citation2 else (),
...

or equivalently

/doctype1//@citation1,
/doctype2//@citation2

Of course, a schema-aware processor could in principle do this optimization
for you - but at the time of writing, it doesn't!

Michael Kay
http://www.saxonica.com/


Put differently, I want to be able to easily add support for 
different 
input document types.  Elsewhere in the stylesheets -- where 
I actually 
format the citations -- I can just use xsl:choose to figure 
out what to 
do.

It seems from Geert's explanation, the keys would be more efficient 
than the example I posted.  I don't really understand how that'd 
compare to the template rules suggestion here.

Bruce


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>