|
Subject: [xsl] efficiency with id() From: James Cummings <James.Cummings@xxxxxxxxx> Date: Thu, 3 Jul 2003 10:41:03 +0100 (BST) |
Ok, let's say you have a file of:
-----
<?xml version="1.0"?>
<foo>
<bar>
<blort>
<p id="c1001"><body wit="A B C">This is a
<app><rdg wit="A B">test</rdg><rdg wit="C">really big test</rdg></app>
but only a test!</body></p>
<p id="c1002"><body wit="A B C">This is a
<app><rdg wit="A B">test</rdg><rdg wit="C">really big test</rdg></app>
but only a test!</body></p>
<p id="c1003"><body wit="A B C">This is a
<app><rdg wit="A B">test</rdg><rdg wit="C">really big <add> place="supra">test</add></rdg></app>
but only a test!</body></p>
...
<p id="c9205"><body wit="A B C">This is a
<app><rdg wit="A B">test</rdg><rdg wit="C">really <gap/>test</rdg></app>
but only a test!</body></p>
</blort>
</bar>
</foo>
-----
What is the most efficient/quickest way of grabing a copy-of a particular <p> (and
children) by its @id?
Is it best to do something like:
-----
<xsl:template match="/">
<xsl:copy-of select="id($id)"/>
</xsl:template
<!-- and another empty template matching anything you don't want to display -->
-----
or is there a quicker way? Is key() quicker? The @id is in reality declared as
type ID, so seems reasonable to use that. (This is for a quite large (well 2.5meg), file,
which admittedly would probably be better just burst out into seperate files
for each <p> element in this example.) Any suggestions appreciated.
-James
---
Dr James Cummings, James.Cummings@xxxxxxxxx, http://www.uea.ac.uk/~q503
Cursus Project, School of Music, University of East Anglia,
Norwich, Norfolk, NR4 7TJ, UK Tel:(01603)593-595
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] xpath confusion, Bodrul Haque | Thread | Re: [xsl] efficiency with id(), Jeni Tennison |
| [xsl] xpath confusion, Bodrul Haque | Date | Re: [xsl] xpath confusion, Jeni Tennison |
| Month |