Hi,
I am in a situation where I need to generate a transformation in a pipeline and this transformation needs to access itself using document(""). The problem is that because this transformation lives in a pipeline, it has no base URI and the document("") function doesn't work. Is there a way to force a base URI so that this function can be used? Thanks, Eric -- GPG-PGP: 2A528005 Lisez-moi sur XMLfr. http://xmlfr.org/index/person/eric+van+der+vlist/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws signature.asc (196 bytes) Download Attachment |
Administrator
|
Eric,
On Thu, Apr 10, 2008 at 3:10 PM, Eric van der Vlist <[hidden email]> wrote: > I am in a situation where I need to generate a transformation in a > pipeline and this transformation needs to access itself using > document(""). So you'd like to access the XML for the stylesheet inside the stylesheet itself; is that right? Maybe in addition to feeding the stylesheet to the oxf:xslt processor "config" input, you can feed it to the, say, "stylesheet" input. Then in the stylesheet you can access doc('input:stylesheet'). Would that work? Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ Personal Blog: http://avernet.blogspot.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Hi Alex,
Le jeudi 10 avril 2008 à 19:03 -0700, Alessandro Vernet a écrit : > Eric, > > On Thu, Apr 10, 2008 at 3:10 PM, Eric van der Vlist <[hidden email]> wrote: > > I am in a situation where I need to generate a transformation in a > > pipeline and this transformation needs to access itself using > > document(""). > > So you'd like to access the XML for the stylesheet inside the > stylesheet itself; is that right? Maybe in addition to feeding the > stylesheet to the oxf:xslt processor "config" input, you can feed it > to the, say, "stylesheet" input. Then in the stylesheet you can access > doc('input:stylesheet'). Would that work? However, I am running into another issue that I'll try to reduce to a simple repro case that seems to involve a strange caching behavior of the stylesheet input: I am not 100% sure yet, but it looks like it isn't available when I reload a page involving the same resources (or in other words, it works the first time after an update of the source document from which the stylesheet is generated). I am still running 3.6.0, have you fixed things that could explain that in newer versions? Thanks, Eric > Alex -- GPG-PGP: 2A528005 Le premier annuaire des apiculteurs 100% XML! http://apiculteurs.info/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws signature.asc (196 bytes) Download Attachment |
Le vendredi 11 avril 2008 à 11:51 +0200, Eric van der Vlist a écrit :
> However, I am running into another issue that I'll try to reduce to a > simple repro case that seems to involve a strange caching behavior of > the stylesheet input: I am not 100% sure yet, but it looks like it isn't > available when I reload a page involving the same resources (or in other > words, it works the first time after an update of the source document > from which the stylesheet is generated). > > I am still running 3.6.0, have you fixed things that could explain that > in newer versions? This is still the case in the latest night build and doesn't seem obvious to reduce to a simple repro :-( ... Eric (still trying to reduce his repro case) -- GPG-PGP: 2A528005 Did you know it? Python has now a Relax NG (partial) implementation. http://advogato.org/proj/xvif/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws signature.asc (196 bytes) Download Attachment |
Le vendredi 11 avril 2008 à 12:36 +0200, Eric van der Vlist a écrit :
> Le vendredi 11 avril 2008 à 11:51 +0200, Eric van der Vlist a écrit : > > > However, I am running into another issue that I'll try to reduce to a > > simple repro case that seems to involve a strange caching behavior of > > the stylesheet input: I am not 100% sure yet, but it looks like it isn't > > available when I reload a page involving the same resources (or in other > > words, it works the first time after an update of the source document > > from which the stylesheet is generated). > > > > I am still running 3.6.0, have you fixed things that could explain that > > in newer versions? > > This is still the case in the latest night build and doesn't seem > obvious to reduce to a simple repro :-( ... > > Eric (still trying to reduce his repro case) <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ap="http://apiculteurs.info/ns/presentation/" xmlns:pfc="http://www.orbeon.com/oxf/controller"> <p:param name="data" type="input"/> <p:param name="data" type="output"/> <p:processor name="oxf:unsafe-xslt"> <p:input name="data" href="test2.xml"/> <p:input name="config"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://example.com" xmlns:axsl="http://www.w3.org/1999/XSL/Transform/fake" version="2.0"> <xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/> <xsl:output indent="yes"/> <xsl:template match="/"> <xsl:variable name="idroot" select="generate-id(/*)"/> <axsl:stylesheet version="2.0"> <axsl:param name="transformation">input:transformation</axsl:param> <x:data> <xsl:value-of select="$idroot"/> </x:data> <axsl:template match="/"> <html> <title>test</title> <body> <p>Id of the root element: <xsl:value-of select="$idroot"/></p> <p>Data element in the generated stylesheet: <axsl:value-of select="document($transformation)/*/x:data"/></p> </body> </html> </axsl:template> </axsl:stylesheet> </xsl:template> </xsl:stylesheet> </p:input> <p:output name="data" id="compiled"/> </p:processor> <p:processor name="oxf:unsafe-xslt"> <p:input name="data" href="#data"/> <p:input name="config" href="#compiled"/> <p:input name="transformation" href="#compiled"/> <p:output name="data" ref="data"/> </p:processor> </p:config> The first time I try it, I get: +++++++++++++ Id of the root element: d7e1 Data element in the generated stylesheet: d7e1 +++++++++++++ And the next time: +++++++++++++ Id of the root element: d7e1 Data element in the generated stylesheet: d8e1 +++++++++++++ See what's happening? To make it short, the first line is the ID as found in the second XSLT config input and the second line is the same ID as found in its transformation input. Both should be the same document, but it looks like although the first one is always cached, the second one is reevaluated. This would be only a performance issue if in my real transformation I wasn't relying on these IDs to perform computed treatments! Can you enter a bug for that? Shorter term, is there an easy workaround? Thanks, Eric -- GPG-PGP: 2A528005 Weblog: http://eric.van-der-vlist.com/blog?t=category&a=English ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws signature.asc (196 bytes) Download Attachment |
Le vendredi 11 avril 2008 à 12:59 +0200, Eric van der Vlist a écrit :
> Shorter term, is there an easy workaround? I guess I can replace generate-id by a custom function that returns the same value at each run... Eric -- GPG-PGP: 2A528005 Lisez-moi sur XMLfr. http://xmlfr.org/index/person/eric+van+der+vlist/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws signature.asc (196 bytes) Download Attachment |
In reply to this post by Eric van der Vlist
Hmmm... Should I create a bug with this repro?
Thanks, Eric Le vendredi 11 avril 2008 à 12:59 +0200, Eric van der Vlist a écrit : > Le vendredi 11 avril 2008 à 12:36 +0200, Eric van der Vlist a écrit : > > Le vendredi 11 avril 2008 à 11:51 +0200, Eric van der Vlist a écrit : > > > > > However, I am running into another issue that I'll try to reduce to a > > > simple repro case that seems to involve a strange caching behavior of > > > the stylesheet input: I am not 100% sure yet, but it looks like it isn't > > > available when I reload a page involving the same resources (or in other > > > words, it works the first time after an update of the source document > > > from which the stylesheet is generated). > > > > > > I am still running 3.6.0, have you fixed things that could explain that > > > in newer versions? > > > > This is still the case in the latest night build and doesn't seem > > obvious to reduce to a simple repro :-( ... > > > > Eric (still trying to reduce his repro case) > > Got it! > > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" > xmlns:oxf="http://www.orbeon.com/oxf/processors" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:ap="http://apiculteurs.info/ns/presentation/" > xmlns:pfc="http://www.orbeon.com/oxf/controller"> > > <p:param name="data" type="input"/> > <p:param name="data" type="output"/> > > <p:processor name="oxf:unsafe-xslt"> > <p:input name="data" href="test2.xml"/> > <p:input name="config"> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns="http://www.w3.org/1999/xhtml" xmlns:x="http://example.com" > xmlns:axsl="http://www.w3.org/1999/XSL/Transform/fake" version="2.0"> > <xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/> > <xsl:output indent="yes"/> > <xsl:template match="/"> > <xsl:variable name="idroot" select="generate-id(/*)"/> > <axsl:stylesheet version="2.0"> > <axsl:param name="transformation">input:transformation</axsl:param> > <x:data> > <xsl:value-of select="$idroot"/> > </x:data> > <axsl:template match="/"> > <html> > <title>test</title> > <body> > <p>Id of the root element: <xsl:value-of select="$idroot"/></p> > <p>Data element in the generated stylesheet: <axsl:value-of > select="document($transformation)/*/x:data"/></p> > </body> > </html> > </axsl:template> > </axsl:stylesheet> > </xsl:template> > </xsl:stylesheet> > </p:input> > <p:output name="data" id="compiled"/> > </p:processor> > > > <p:processor name="oxf:unsafe-xslt"> > <p:input name="data" href="#data"/> > <p:input name="config" href="#compiled"/> > <p:input name="transformation" href="#compiled"/> > <p:output name="data" ref="data"/> > </p:processor> > > </p:config> > > The first time I try it, I get: > > > +++++++++++++ > Id of the root element: d7e1 > > Data element in the generated stylesheet: d7e1 > +++++++++++++ > > And the next time: > > +++++++++++++ > Id of the root element: d7e1 > > Data element in the generated stylesheet: d8e1 > +++++++++++++ > > See what's happening? > > To make it short, the first line is the ID as found in the second XSLT > config input and the second line is the same ID as found in > its transformation input. > > Both should be the same document, but it looks like although the first > one is always cached, the second one is reevaluated. > > This would be only a performance issue if in my real transformation I > wasn't relying on these IDs to perform computed treatments! > > Can you enter a bug for that? > > Shorter term, is there an easy workaround? > > Thanks, > > Eric > > > > > > -- > GPG-PGP: 2A528005 > Weblog: > http://eric.van-der-vlist.com/blog?t=category&a=English > ------------------------------------------------------------------------ > Eric van der Vlist http://xmlfr.org http://dyomedea.com > (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax > (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema > ------------------------------------------------------------------------ Did you know it? Python has now a Relax NG (partial) implementation. http://advogato.org/proj/xvif/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws signature.asc (196 bytes) Download Attachment |
Administrator
|
In reply to this post by Eric van der Vlist
Eric,
On Fri, Apr 11, 2008 at 3:59 AM, Eric van der Vlist <[hidden email]> wrote: > See what's happening? > > To make it short, the first line is the ID as found in the second XSLT > config input and the second line is the same ID as found in > its transformation input. I think it comes down to the fact that if in different execution of a stylesheet you run generate-id() on the node of the same document, you have no guarantee that generate-id() will return the same result. I think that the behavior you see is in compliance with the specification :). Like you said, a workaround is to use your own function that returns the same ID every time (sometimes counting the number of preceding nodes in document order is good enough). Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ Personal Blog: http://avernet.blogspot.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Hi Alex,
Le mercredi 16 avril 2008 à 18:59 -0700, Alessandro Vernet a écrit : > Eric, > > On Fri, Apr 11, 2008 at 3:59 AM, Eric van der Vlist <[hidden email]> wrote: > > See what's happening? > > > > To make it short, the first line is the ID as found in the second XSLT > > config input and the second line is the same ID as found in > > its transformation input. > > I think it comes down to the fact that if in different execution of a > stylesheet you run generate-id() on the node of the same document, you > have no guarantee that generate-id() will return the same result. I > think that the behavior you see is in compliance with the > specification :). behavior. It doesn't seem normal to me that the stylesheet is evaluated twice in that case: IMO the result should/could be cached and reused for both the config and the transformation input of the second transformation. The fact that it is cached during the first execution of the pipeline after I update the main source document and that during the following executions, one of the inputs uses that same cached value while the other uses a fresh evaluation makes me really think that there is a bug at this level. > Like you said, a workaround is to use your own function that returns > the same ID every time (sometimes counting the number of preceding > nodes in document order is good enough). Yes, that's what I did, but that's only a poor workaround :) Eric > Alex -- GPG-PGP: 2A528005 Le premier annuaire des apiculteurs 100% XML! http://apiculteurs.info/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws signature.asc (196 bytes) Download Attachment |
Administrator
|
Eric,
On Wed, Apr 16, 2008 at 11:01 PM, Eric van der Vlist <[hidden email]> wrote: > It doesn't seem normal to me that the stylesheet is evaluated twice in > that case: IMO the result should/could be cached and reused for both the > config and the transformation input of the second transformation. Let's see if I understood this right. In the second processor, you have: <p:input name="config" href="#compiled"/> <p:input name="transformation" href="#compiled"/> The second time the XPL runs, the "config" input can be already in cache. So it may be the case that it isn't read again. But the "transformation" input will never be cached. So if the stylesheet runs, that input will be read again. The reason for this is that in general processors cache their "config" but not the "data" they are processing. The reasons for this is that configurations (in this case the stylesheet) are considered to be less likely to change, more likely to be a smaller documents and/or documents on which expensive processing is happening. Does this make sense? Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ Personal Blog: http://avernet.blogspot.com/ Twitter - http://twitter.com/avernet -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Hi Alex,
Le vendredi 18 avril 2008 à 16:06 -0700, Alessandro Vernet a écrit : > Eric, > > On Wed, Apr 16, 2008 at 11:01 PM, Eric van der Vlist <[hidden email]> wrote: > > It doesn't seem normal to me that the stylesheet is evaluated twice in > > that case: IMO the result should/could be cached and reused for both the > > config and the transformation input of the second transformation. > > Let's see if I understood this right. In the second processor, you have: > > <p:input name="config" href="#compiled"/> > <p:input name="transformation" href="#compiled"/> > > The second time the XPL runs, the "config" input can be already in > cache. So it may be the case that it isn't read again. But the > "transformation" input will never be cached. So if the stylesheet > runs, that input will be read again. > The reason for this is that in > general processors cache their "config" but not the "data" they are > processing. The reasons for this is that configurations (in this case > the stylesheet) are considered to be less likely to change, more > likely to be a smaller documents and/or documents on which expensive > processing is happening. Does this make sense? Yes, that makes sense that some inputs are cached and other are not, but I was not aware that this was done based on the input names! Wouldn't it be possible to add some control over the cache behavior in the pipeline itself? Maybe through cache attributes? I seems really important to me that we can have this kind of control. Eric > Alex -- GPG-PGP: 2A528005 Le premier annuaire des apiculteurs 100% XML! http://apiculteurs.info/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws signature.asc (196 bytes) Download Attachment |
Administrator
|
On Fri, Apr 18, 2008 at 11:19 PM, Eric van der Vlist <[hidden email]> wrote:
> Yes, that makes sense that some inputs are cached and other are not, but > I was not aware that this was done based on the input names! > > Wouldn't it be possible to add some control over the cache behavior in > the pipeline itself? Maybe through cache attributes? I seems really > important to me that we can have this kind of control. I guess we could. This would be some parameter, kind of a hint, that is passed down to the processor, because it is the processor (not the pipeline engine) that decides what to cache. The processor can decide if and how each input is cached. (And the general rule I was talking about with "config" vs. "data" is just a rule of thumb.) Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ Personal Blog: http://avernet.blogspot.com/ Twitter - http://twitter.com/avernet -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |