Subject: RE: [xsl] Filtering XML to improve performance From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx> Date: Sun, 21 Mar 2004 11:37:50 +0100 |
> -----Original Message----- > From: Kenny Akridge [mailto:kenny@xxxxxxxxxxxxxxxxx] > > <snip /> > If I only mainly want to work with <onlyImportantItems>, is there > a way that I can filter out all the other data I don't need when I do the transform? > > So for instance, I don't want the XML parser searching through all the > garbage, I want it cut down to just the data I need. Can I do something > like this at the beginning of all my xsl sheets? > Hi, IIC the source document is, well, whatever source document you provide, so I don't think you can just avoid the rest of the input file being parsed... unless by performing another transform in a first step, which does nothing more than construct a new XML containing only your relevant nodes. The following transform can have this stripped XML as input... but the original XML source has to be parsed anyway, albeit only to filter out the desired nodes. However, why don't you do, for example, at the top-level of your stylesheet: <xsl:variable name="vitems" select="root/item/onlyImportantItem" /> Since the original input has to get parsed anyway, this will give you easy access to the important items. Then further on: <xsl:apply-templates select="$vitems/*" /> and <xsl:template match="onlyImportantItem"> <!-- ... --> </xsl:template> Hope this approaches what you're looking for. Cheers, Andreas
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Filtering XML to improve perf, Kenny Akridge | Thread | RE: [xsl] Filtering XML to improve , Jarno.Elovirta |
[xsl] Filtering XML to improve perf, Kenny Akridge | Date | RE: [xsl] managing parameters to st, Michael Kay |
Month |