Subject: SV: [xsl] questions about preceding::processing-instruction From: "Erik Zander erik.zander@xxxxxxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 10 Apr 2017 14:35:31 -0000 |
Thanks Gerrit, You pointed me in the right direction so I could avoid the timeout :) The solution was close at hand <xsl:variable name="currentPage" select="substring-before(substring-after(./preceding::processing-instruction( 'anchor')[1], 'Page.'), '"')"/> Just using the fact that preceding is in reverse order :) Regards Erik -----Ursprungligt meddelande----- FrC%n: Imsieke, Gerrit, le-tex gerrit.imsieke@xxxxxxxxx [mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx] Skickat: den 10 april 2017 15:31 Till: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Cmne: Re: [xsl] questions about preceding::processing-instruction On 10.04.2017 15:12, Erik Zander erik.zander@xxxxxxxxxxxxxxxxxxxx wrote: > Hi All! > > I have an optimization problem concerning > preceding::processing-instruction. > > First some background in my xml I have processing instructions like > <?anchor xml:id="orgPage.7"/?> representing the start of a page. > > And I have a template that matches on *text().* > > In the template matching on text() I want to know the page number. > > To get this I have in the text template declared a variable as > > <xsl:variablename="currentPage"select="substring-before(substring-afte > r(((./preceding::processing-instruction('anchor'))[last()]), > 'Page.'), '"')"/> > > Which works (although I donbt see why as I had the understanding that > preceding:: returned in reverse document order) but it takes up a > great deal of the processing time. > > So my questions are: > > Is there a better (faster/smarter) way to get the page from the > processing instruction. Maybe put all of them into a global variable and then do something like ($all-page-anchors[. << current()])[last()] > > And is it the expected behavior that calling > preceding:processing-instruction() gives me > > <?anchor xml:id="orgPage.1"/?> > > <?anchor xml:id="orgPage.2"/?> > > <?anchor xml:id="orgPage.3"/?> > > <?anchor xml:id="orgPage.4"/?> > > I have this behavior in both Saxon 9.6.0.7 and Marklogic. This is because the ( ) around the expression effects that the nodes will be put in document order. See the note after https://www.w3.org/TR/xpath20/#dt-numeric-predicate Gerrit > > Regards > > Erik Zander > > XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list> > EasyUnsubscribe <-list/225679> > (by email <>) -- Gerrit Imsieke GeschC$ftsfC<hrer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de Registergericht / Commercial Register: Amtsgericht Leipzig Registernummer / Registration Number: HRB 24930 GeschC$ftsfC<hrer: Gerrit Imsieke, Svea Jelonek, Thomas Schmidt, Dr. Reinhard VC6ckler
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] questions about preceding, Imsieke, Gerrit, le- | Thread | Re: SV: [xsl] questions about prece, Imsieke, Gerrit, le- |
Re: [xsl] questions about preceding, Imsieke, Gerrit, le- | Date | Re: SV: [xsl] questions about prece, Imsieke, Gerrit, le- |
Month |