Subject: RE: [xsl] doc() concat expression and whitespace error From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Fri, 19 Nov 2004 04:51:07 -0000 |
You would get extra flexibility by issuing an "abstract query" from your stylesheet and using a URIResolver to convert it to a concrete eXist query. The "abstract query" might be a URI such as http://query/?citekeys= + $citekeys which you could parse in your URIResolver using the methods available on the java.net.URI class. Then all you would need to get the data from a different source would be a different URIResolver. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Bruce D'Arcus [mailto:bdarcus@xxxxxxxxxxxxx] > Sent: 18 November 2004 22:44 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: Re: [xsl] doc() concat expression and whitespace error > > On Nov 16, 2004, at 12:02 PM, Bruce D'Arcus wrote: > > >> Can the former be made faster? > > > > The easiest way is instead of sending a single query for each > > distinct-value of the "citekey" key, I somehow send a query > that asks > > for all of them at once. > > > > I'm not quite sure who to do that, though. I know that I > want a "for > > $key in $keys return mods:mods[ID='$key']" sort of > expression; I just > > don't know how to do that with the key. > > OK, we got it working so the stylesheets grab the entire > collection of > bibliographic records at once (sort of a PITA with the url > escaping). > With a bug fixed in eXist, it seems to be much faster than > the earlier > approach. > > Does anyone have any feedback on if there is a better, more flexible, > way to code this? I'd like to make it easy for people to switch to > different storage options (flat files and other sorts of > url-queries in > particular), probably even with a parameter option. > > <xsl:template match="db:bibliography" mode="create-bibcollection"> > <xsl:variable name="citekeys"> > <xsl:text>(</xsl:text> > <xsl:for-each select="distinct-values(key('citekey', 'all'))"> > <xsl:if test="position() > 1">,%20</xsl:if> > <xsl:text>'</xsl:text> > <xsl:value-of select="."/> > <xsl:text>'</xsl:text> > </xsl:for-each> > <xsl:text>)</xsl:text> > </xsl:variable> > <!--+ > ============================================================== > | bibrecord variable identifies where to locate the bib > records; in > | this case, we access them via http from an eXist XML DB > +--> > <xsl:variable name="bibrecord" > > select='doc(concat("http://localhost:8080/exist/servlet/db/biblio?", > > "_query=declare%20namespace%20mods=%22http://www.loc.gov/mods/v3%22;", > "%20for%20$citekey%20in%20", > $citekeys, > > "%20return%20/mods:modsCollection/mods:mods[@ID=$citekey]"))' /> > <bibliography> > <modsCollection xmlns="http://www.loc.gov/mods/v3"> > <xsl:copy-of select="$bibrecord/exist:result/mods:mods" /> > </modsCollection> > </bibliography> > </xsl:template> > > Bruce
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] doc() concat expression a, Bruce D'Arcus | Thread | Re: [xsl] doc() concat expression a, Bruce D'Arcus |
RE: [xsl] using only xpath string t, Arun Sinha | Date | RE: [xsl] Sorting and Paging in one, Michael Kay |
Month |