You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Edward L. Knoll" <ed...@cosd.fedex.com> on 2004/08/25 23:09:54 UTC
Question regarding use of indent-amount with Serializers.
I was successfully using the indent-amount attribute in a stylesheet
when I was using org.apache.xalan.xslt.Process to process the
stylesheet. I'm now processing the stylesheet (from Java) using a
Transformer class with output to a DOMResult class and then using a
(xml) Serializer class to write the DOMResult to a file. I have not
been able to figure out how to control the indent-amount in this context.
Does the indent-amount work in this context, and if so, how do set it up?
Thanks,
Ed Knoll
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Any way to get org.apache.xalan.xslt.Process arguments inside XSL?
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
Is there any way to access any of the arguments passed to
org.apache.xalan.xslt.Process within the XSL stylesheet? Specifically,
I was wondering if there were anyway to get any of the following:
- name of the input XML file being processed (if any)
- name of the XSL stylesheet
- name of the output XML file
I realize I could pass these as parameters to the stylesheet. I'm
wondering if there is any other built-in mechanism for getting these.
Thanks,
Ed Knoll
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Xalan=J extensions - datetime:format-date() question.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
Will (the Xalan implementation) of datetime:format-date() support the
specification of UTZ timezone offsets on incoming date/time strings
(e.g. Z-HH:MM, Z+HH:MM)? It doesn't appear to be, but I could be doing
something wrong.
If it does not, do any of the other (Xalan) datetime:*
functions/templates support specification of UTZ timezone offsets or are
there any other xsl/xalan facilities for doing date/time conversions
between timezones.
Thanks,
Ed Knoll
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
Xalan=J extensions - datetime:format-date() question.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
Will (the Xalan implementation) of datetime:format-date() support the
specification of UTZ timezone offsets on incoming date/time strings
(e.g. Z-HH:MM, Z+HH:MM)? It doesn't appear to be, but I could be doing
something wrong.
If it does not, do any of the other (Xalan) datetime:*
functions/templates support specification of UTZ timezone offsets or are
there any other facilities for doing date/time conversions between
timezones.
Thanks,
Ed Knoll
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Way to create single DOM(Source) from multiple DOM(Result)s.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
I can create a DOMSource from a DOMResult. We have a situation where we
want to perform a transformation on a merged set of DOMResults. I
there a way to create a single DOMSource from multiple DOMResults?
Thanks,
Ed Knoll
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
Xalan=J: Can/how do you make a DOMSource object from a DOMResults
object?
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
I have a stylesheet which takes a generated XML file and produces an
HTML file. It works as expected when I process it directly with
org.apache.xalan.xslt.Process. Now I'm chaining XSL transformation
which creates the generated XML to the transformation which generates
the HTML inside Java. Both transformations are setup to take a
DOMSource and generate a DOMResult. I'd like to take the DOMResult from
the first transformation and change it to a DOMSource for the second
transformation. Logically I'm doing the following:
DOMResult pass1Result = new DOMResult();
....
DOMSource pass2Source = new DOMSource( pass1Result.getNode() );
This doesn't seem to be working; I'm getting an error returned from the
Transformer when it tries process pass2Source.
Can I even do this? If so, how (if I'm not doing it correctly)?
Thanks,
Ed
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Why does copy transform take so long?
Posted by Santiago Pericas-Geertsen <Sa...@Sun.COM>.
On Sep 28, 2004, at 11:23 AM, Edward L. Knoll wrote:
> We use the output DOM, because from this stage we will both (a)
> serialize the output to a file and (b) apply a second transformation
> to the output DOM.
I guess Joe answered this part already.
> The input DOM may not be strictly necessary for actual operation; we
> get our input as a byte-array and I could use a stream source for the
> input. However, for purposes of evaluating and isolating the
> different contributors to the performance, I wanted to separate the
> time to parse the input XML from the time to transform the input XML.
It would be more accurate to create a SAXParser with an empty content
handler in order to time the parsing part. As Joe pointed out, DOM is
not Xalan's preferred infoset flavor.
-- Santiago
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Why does copy transform take so long?
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
I think I can; I doubt there's any issue with the possible exception of
the input XML file and I'm checking that. When you said "attach" I
presume that means I can supply the piece parts as literal file attachments.
Brian Minchau wrote:
>
>
>Ed,
>please open a JIRA issue against XalanJ2 and attach your stylesheet (which
>I presume isn't too big) and your input XML. Please don't attach a
>multi-megabyte XML document. If the form of that XML is something like
>this:
><doc>
><record>...</record>
><record>...</record>
>...
><doc>
>then please just attach a small sample with instructions on how many times
>a particular <record> needs to be repeated to get the performance issue
>that you are reporting.
>
>Please include how you are running this. Is it from the command line with
>org.apache.xalan.xslt.Process, or just how?
>
>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Why does copy transform take so long?
Posted by Brian Minchau <mi...@ca.ibm.com>.
Ed,
please open a JIRA issue against XalanJ2 and attach your stylesheet (which
I presume isn't too big) and your input XML. Please don't attach a
multi-megabyte XML document. If the form of that XML is something like
this:
<doc>
<record>...</record>
<record>...</record>
...
<doc>
then please just attach a small sample with instructions on how many times
a particular <record> needs to be repeated to get the performance issue
that you are reporting.
Please include how you are running this. Is it from the command line with
org.apache.xalan.xslt.Process, or just how?
----------
Brian Minchau
XSLT Development, IBM Toronto
e-mail: minchau@ca.ibm.com
"Edward L. Knoll"
<ed.knoll@cosd.fe
dex.com> To
xalan-dev@xml.apache.org
09/28/2004 11:23 cc
AM
Subject
Re: Why does copy transform take so
Please respond to long?
xalan-dev
The goal of this performance test was to attempt to characterize the
performance of our real XSL which transforms an input XML to an output
XML. Most of the input XML elements will appear in the output XML. A
significant percentage of the input XML elements are transformed; such
transforms always introduce child elements in the output XML.
My purposes in doing this test was to provide a lower bound on our
performance; we can not be faster then executing a simple transform
which copies input to output. Taking advantage of the built-in
identity transform wouldn't not support this evaluation.
We use the output DOM, because from this stage we will both (a)
serialize the output to a file and (b) apply a second transformation to
the output DOM.
The input DOM may not be strictly necessary for actual operation; we get
our input as a byte-array and I could use a stream source for the
input. However, for purposes of evaluating and isolating the different
contributors to the performance, I wanted to separate the time to parse
the input XML from the time to transform the input XML.
From my perspective (unless I'm missing something which is why I posted
here), this copy transform should represent the lower bound on our
performance.
Santiago Pericas-Geertsen wrote:
>
> On Sep 27, 2004, at 3:17 PM, Edward L. Knoll wrote:
>
>> I'm running on a Sun/Solaris platform. We're running Xalan-J 2.4 and
>> JDK 1.4. Our Java program does the following:
>> - loads the XSL style sheet into a javax.xml.transform.Templates,
>> - loads the XML file into a javax.xml.transform.dom.DOMSource
>> - transforms the DOMSource into a javax.xml.transform.dom.DOMResult
>> using javax.xml.transform.Transformer
>> - serializes the DOMResult to an output file using
>> org.apache.xml.serializer.Serializer
>
>
> Do you really need all these steps? This will create 3 DOMs in
> memory, the input, the output and the internal one created by Xalan
> (DTM). Seems unnecessary, but I don't know exactly what the app is doing.
>
>> The core template we're using for the copy is the following:
>>
>> <xsl:template name="CopyAll" match="*">
>> <xsl:copy>
>> <xsl:copy-of select="@*" />
>> <xsl:apply-templates />
>> </xsl:copy>
>> </xsl:template>
>
>
> Could you use the built-in identity transform instead? Not the same
> as the stylesheet above, but may have the same outcome depending on
> the XML files that you're processing --note that using the built-in
> identity transform will not require the creation of a DTM.
>
>> Following is a breakdown on the performance:
>> - loading the stylesheet : 1.7 seconds
>> - loading XML file : 0.3 seconds
>> - creating Transform instance from Transforms: <0.1 seconds
>> - serializing to output file: 0.4 seconds
>> - executing copy transform: 2.1 seconds
>
>
> Are these averages of multiple runs? These are awfully high numbers.
> Have you run this 100 or more times dropping the first few iterations
> to exclude class loading, etc.?
>
> -- Santiago
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xalan-dev-help@xml.apache.org
>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Problem with Transformer.setParameter() in SAX chain.
Posted by Henry Zongaro <zo...@ca.ibm.com>.
Hi, Edward.
"Edward L. Knoll" <ed...@cosd.fedex.com> wrote on 10/20/2004 08:00:45
PM:
> I have chain of Sax handlers which is effectively a XMLReader chained to
> SAXTransformer chained to a custom ContentHandler chained to a
> Serializer. I am actually parsing multiple XML input streams to
> generate a single output XML stream. The custom Content Handler
...
>
> I need to change a parameter with the SAXTransformer for each file
> processed. This parameter is used to generate an output element for
...
> My problem is that the elements in the output XML which represent this
> changing parameter only have the last value this parameter was set to.
> I've tried doing a Transformer.clearParameters() between
> XMLReader.parse() actions, but that appears to have no affect.
When you say that you're using a SAXTransformer, I assume you mean
you're using a TransformerHandler. Is that correct?
There's a long-standing issue in Xalan-J Interpretive over the fact
that TransformerHandler objects cannot be reused.[1] I don't believe that
that restriction's ever been clearly stated in the JAXP specification.
However, I think it is a reasonable restriction, given the following
statement in the Javadoc for ContentHandler.endDocument() [2]:
The SAX parser will invoke this method only once, and it will
be the last method invoked during the parse.
Currently, Xalan-Java Interpretive produces a NullPointerException if
you attempt to reuse a TransformerHandler, so I'm not sure whether you're
using Xalan-J Interpretive or XSLTC. In any event, I think the right
thing to do is create a Templates object, and prior to each parse, use
SAXTransformerFactory.newTransformerHandler(Templates) to create a new
TransformerHandler from the Templates object. Then set the parameter
value and connect the XMLReader to the new TransformerHandler and the
TransformerHandler to the custom ContentHandler.
I hope that helps.
Thanks,
Henry
[1] http://nagoya.apache.org/jira/secure/ViewIssue.jspa?key=XALANJ-101
[2]
http://xml.apache.org/xalan-j/apidocs/org/xml/sax/ContentHandler.html#endDocument()
------------------------------------------------------------------
Henry Zongaro Xalan development
IBM SWS Toronto Lab T/L 969-6044; Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: XSL template priority problem in SAX processing stream.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
Please disregard this. A misedited file appeared to resolve the
problem; taking the mode attribute off did not fix the problem.
Edward L. Knoll wrote:
> I have isolated the problem further: the templates where priorities
> are not working also have mode attributes. If I take the mode
> attributes off, the templates work correctly.
>
> Unfortunately, company policy regarding software/confidential material
> will not allow me to post the input/source I'm using. However, if I
> can reproduce the problem in a smaller context, I will open the JIRA bug.
>
> Morris Kwan wrote:
>
>> I believe template priority should work in all modes of transformation,
>> without any code change from the user side. Please open a bug in the
>> JIRA
>> database (http://nagoya.apache.org/jira/secure/Dashboard.jspa) and
>> attach
>> the input xml, stylesheet and the Java code to reproduce the problem.
>>
>> Morris Kwan
>> XSLT Development
>> IBM Toronto Lab
>> Tel: (905)413-3729
>> Email: mkwan@ca.ibm.com
>>
>>
>>
>>
>>
>>
>> We have a XSL stylesheet which has prioritized templates. It was
>> working as expected when we were using org.apache.xalan.xslt.Process to
>> process it. We've since changed our processing to be handled by a
>> chain of SAX content handlers with the core XSL processing being handled
>> by a TransformerHandler created from a Templates handler created from a
>> SAXTransformerFactory.
>>
>> Now it appears that template priority is not being recognized at all.
>>
>> We're using Xalan-Java 2.6 on Solaris platform. We are overriding the
>> default version of Xalan used by the Solaris java command by overriding
>> the bootclasspath.
>>
>> Is this a (known) Xalan-Java bug, is there something we have to
>> change/do to enable template prioritization, do we have to change how
>> prioritization values are expressed with the SAX components?
>>
>>
>>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: XSL template priority problem in SAX processing stream.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
I have isolated the problem further: the templates where priorities are
not working also have mode attributes. If I take the mode attributes
off, the templates work correctly.
Unfortunately, company policy regarding software/confidential material
will not allow me to post the input/source I'm using. However, if I can
reproduce the problem in a smaller context, I will open the JIRA bug.
Morris Kwan wrote:
>I believe template priority should work in all modes of transformation,
>without any code change from the user side. Please open a bug in the JIRA
>database (http://nagoya.apache.org/jira/secure/Dashboard.jspa) and attach
>the input xml, stylesheet and the Java code to reproduce the problem.
>
>Morris Kwan
>XSLT Development
>IBM Toronto Lab
>Tel: (905)413-3729
>Email: mkwan@ca.ibm.com
>
>
>
>
>
>
>We have a XSL stylesheet which has prioritized templates. It was
>working as expected when we were using org.apache.xalan.xslt.Process to
>process it. We've since changed our processing to be handled by a
>chain of SAX content handlers with the core XSL processing being handled
>by a TransformerHandler created from a Templates handler created from a
>SAXTransformerFactory.
>
>Now it appears that template priority is not being recognized at all.
>
>We're using Xalan-Java 2.6 on Solaris platform. We are overriding the
>default version of Xalan used by the Solaris java command by overriding
>the bootclasspath.
>
>Is this a (known) Xalan-Java bug, is there something we have to
>change/do to enable template prioritization, do we have to change how
>prioritization values are expressed with the SAX components?
>
>
>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: XSL template priority problem in SAX processing stream.
Posted by da...@us.ibm.com.
Edward Knoll writes:
>The templates at issues are actually distributed across multiple files.
>A master XSL file references these templates using <xsl:import>. If I
>change the <xsl:import> to an <xsl:include>, the prioritization works.
>...should I expect this behavior?
Yes, import precedence outweighs template priority. We have a conformance
test for this (conflictres09), so we would enforce the required behavior.
.................David Marston
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: XSL template priority problem in SAX processing stream.
Posted by Joseph Kesselman <ke...@us.ibm.com>.
Yes, you should expect that behavior.
Include treats the other file as part of the same stylesheet source
document. Import brings it in at reduced priority -- "lower Importance", if
you need a mnemonic. See the XSLT spec for details.
______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: XSL template priority problem in SAX processing stream.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
The templates at issues are actually distributed across multiple files.
A master XSL file references these templates using <xsl:import>. If
I change the <xsl:import> to an <xsl:include>, the prioritization works.
I've never been entirely sure of the difference between xsl:import and
xsl:include, should I expect this behavior?
Morris Kwan wrote:
>I believe template priority should work in all modes of transformation,
>without any code change from the user side. Please open a bug in the JIRA
>database (http://nagoya.apache.org/jira/secure/Dashboard.jspa) and attach
>the input xml, stylesheet and the Java code to reproduce the problem.
>
>Morris Kwan
>XSLT Development
>IBM Toronto Lab
>Tel: (905)413-3729
>Email: mkwan@ca.ibm.com
>
>
>
>
>
>
>We have a XSL stylesheet which has prioritized templates. It was
>working as expected when we were using org.apache.xalan.xslt.Process to
>process it. We've since changed our processing to be handled by a
>chain of SAX content handlers with the core XSL processing being handled
>by a TransformerHandler created from a Templates handler created from a
>SAXTransformerFactory.
>
>Now it appears that template priority is not being recognized at all.
>
>We're using Xalan-Java 2.6 on Solaris platform. We are overriding the
>default version of Xalan used by the Solaris java command by overriding
>the bootclasspath.
>
>Is this a (known) Xalan-Java bug, is there something we have to
>change/do to enable template prioritization, do we have to change how
>prioritization values are expressed with the SAX components?
>
>
>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: XSL template priority problem in SAX processing stream.
Posted by Morris Kwan <mk...@ca.ibm.com>.
I believe template priority should work in all modes of transformation,
without any code change from the user side. Please open a bug in the JIRA
database (http://nagoya.apache.org/jira/secure/Dashboard.jspa) and attach
the input xml, stylesheet and the Java code to reproduce the problem.
Morris Kwan
XSLT Development
IBM Toronto Lab
Tel: (905)413-3729
Email: mkwan@ca.ibm.com
"Edward L. Knoll"
<ed.knoll@cosd.fe
dex.com> To
xalan-dev@xml.apache.org
11/04/2004 12:37 cc
PM
Subject
XSL template priority problem in
Please respond to SAX processing stream.
xalan-dev
We have a XSL stylesheet which has prioritized templates. It was
working as expected when we were using org.apache.xalan.xslt.Process to
process it. We've since changed our processing to be handled by a
chain of SAX content handlers with the core XSL processing being handled
by a TransformerHandler created from a Templates handler created from a
SAXTransformerFactory.
Now it appears that template priority is not being recognized at all.
We're using Xalan-Java 2.6 on Solaris platform. We are overriding the
default version of Xalan used by the Solaris java command by overriding
the bootclasspath.
Is this a (known) Xalan-Java bug, is there something we have to
change/do to enable template prioritization, do we have to change how
prioritization values are expressed with the SAX components?
Thanks,
Ed Knoll
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
XSL template priority problem in SAX processing stream.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
We have a XSL stylesheet which has prioritized templates. It was
working as expected when we were using org.apache.xalan.xslt.Process to
process it. We've since changed our processing to be handled by a
chain of SAX content handlers with the core XSL processing being handled
by a TransformerHandler created from a Templates handler created from a
SAXTransformerFactory.
Now it appears that template priority is not being recognized at all.
We're using Xalan-Java 2.6 on Solaris platform. We are overriding the
default version of Xalan used by the Solaris java command by overriding
the bootclasspath.
Is this a (known) Xalan-Java bug, is there something we have to
change/do to enable template prioritization, do we have to change how
prioritization values are expressed with the SAX components?
Thanks,
Ed Knoll
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Losing xsl:comment between SAX Transformer and Serializer.
Posted by Brian Minchau <mi...@ca.ibm.com>.
Ed,
I'm guessing that you are using Xalan 2.6.0
This is looking like bug 1966
(http://nagoya.apache.org/jira/browse/XALANJ-1966). Please build Xalan
with that patch an try again.
----------
Brian Minchau
XSLT Development, IBM Toronto
e-mail: minchau@ca.ibm.com
"Edward L. Knoll"
<ed.knoll@cosd.fe
dex.com> To
xalan-dev@xml.apache.org
10/25/2004 07:45 cc
PM
Subject
Losing xsl:comment between SAX
Please respond to Transformer and Serializer.
xalan-dev
We have a XSL stylesheet which generates xsl:comments. We're losing
those comments between the TransformerHandler and the Serializer. The
TransformerHandler we're getting from a
SAXTransformerFactory.newTransformerHandler() using a Templates object.
The Serializer we're getting from SerializerFactory.getSerializer().
The Serializer we get appears to be a LexicalHandler and I've explicitly
called SAXResult.setLexicalHandler() with that same Serializer prior to
assigning the SAXResult wrapping the Serializer to the TransformerHandler.
I'm guessing there's something I missing; can someone help me with this?
Thanks,
Ed Knoll
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Losing xsl:comment between SAX Transformer and Serializer.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
We have a XSL stylesheet which generates xsl:comments. We're losing
those comments between the TransformerHandler and the Serializer. The
TransformerHandler we're getting from a
SAXTransformerFactory.newTransformerHandler() using a Templates object.
The Serializer we're getting from SerializerFactory.getSerializer().
The Serializer we get appears to be a LexicalHandler and I've explicitly
called SAXResult.setLexicalHandler() with that same Serializer prior to
assigning the SAXResult wrapping the Serializer to the TransformerHandler.
I'm guessing there's something I missing; can someone help me with this?
Thanks,
Ed Knoll
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Concurrency issue .... resulved.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
Resolved (probably). Each ContentHandler instance when created was
getting a reference to the root document node of the XML file
representing the static/common filter. Now I return:
(Element) Document.getDocumentElement().cloneNode(true);
This actually didn't eliminate all my exceptions at first, but once I
synchronized the above operation , it appeared to fix my exception
problems. I haven't seen the exception yet and have rerun the test many
times, so that problem is probably fixed (or it might be that the
synchronize changed the timing enough to make it harder to get to).
I still haven't heard; should Node/NodeList be safe to access currently
for read only kind of operations?
Edward L. Knoll wrote:
> We have a custom ContentHandler in a SAX processing chain which we use
> to filter for nodes we wish to pass on. The filter is defined via a
> XML file which we read into a NodeList. Since the filter definition
> is static and we are only reading the NodeList, we set the filter up
> to be shared between instances of the associated ContentHandler.
>
> We are (intermittently) getting exceptions within the
> NodeList.getLength() method. I don't know if our expectations are
> inappropriate or if there is some problem buried within this NodeList
> method/class.
>
> If it is a problem, I can't supply source/data (company proprietary
> policies), so I hope that's enough to go on.
>
> I will be working on an alternate implementation, so am not looking
> for resolution (although suggestions are welcome, if timely :).
>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Concurrency problem with static Java calls.
Posted by Henry Zongaro <zo...@ca.ibm.com>.
Hi, Edward.
"Edward L. Knoll" <ed...@cosd.fedex.com> wrote on 2004-12-20 11:55:43
AM:
> If I'd stopped to think about it, I would not have expected to be able
> to change a result-tree-fragement into a number/integer, but the logic
> appears to work (outside the threading issues). I've included some XSL
> fragments to illustrate:
Just FYI - according to Section 11.1 of XSLT 1.0:[1]
the operations permitted on a result tree fragment are a subset
of those permitted on a node-set. An operation is permitted on
a result tree fragment only if that operation would be permitted
on a string (the operation on the string may involve first
converting the string to a number or boolean)
Thanks,
Henry
[1] http://www.w3.org/TR/xslt#section-Result-Tree-Fragments
------------------------------------------------------------------
Henry Zongaro Xalan development
IBM SWS Toronto Lab T/L 969-6044; Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Concurrency problem with static Java calls.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
Empirical evidence now seems to be pointing at another possible
explanation. The Java function we are calling takes several parameters
which are either integers or strings. Template scope XSL variables
were being used to establish the values of these parameters and then
these local variables were passed to the Java function. I happened to
notice that while all of the Java function parameters where simple types
(e.g. integers/strings), some of the local variables were technically
result-tree-fragments. I eliminated some of these local variables we
were defining and that seemed to reduce the problem incidence rate,
although I can't actually prove a cause and effect relationship.
If I'd stopped to think about it, I would not have expected to be able
to change a result-tree-fragement into a number/integer, but the logic
appears to work (outside the threading issues). I've included some XSL
fragments to illustrate:
<xsl:variable name='Offset'> <!-- [+-]HHMM portion -->
<xsl:variable name='afterZ' select="substring-after($Input,'Z')" />
<xsl:choose>
<xsl:when test="string-length($afterZ)=5">
<xsl:value-of select="$afterZ" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'+0000'" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="Offset_mSec"
select="(number(substring($Offset,2,2)) * 3600000) +
(number(substring($Offset,4,2)) * 60000)" />
<xsl:choose>
<xsl:when test="substring($Offset,1,1) = '-'">
<xsl:value-of select="FastDateFormat:formatDate(
$DateFormatter, $DateFormat,
substring($DateTime,5,2), substring($DateTime,7,2),
substring($DateTime,1,4), substring($DateTime,9,2),
substring($DateTime,11,2), '0', -($Offset_mSec))" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="FastDateFormat:formatDate(
$DateFormatter, $DateFormat,
substring($DateTime,5,2), substring($DateTime,7,2),
substring($DateTime,1,4), substring($DateTime,9,2),
substring($DateTime,11,2), '0', $Offset_mSec)" />
</xsl:otherwise>
</xsl:choose>
Edward L. Knoll wrote:
> Spoke to soon. The incident rate dropped a lot, but the problem still
> persistes.
>
> Edward L. Knoll wrote:
>
>> Context: Xalan-J, 2.6.0; SAX transformation chain.
>>
>> We were having a concurrency operation associated with a call to a
>> static Java method we were making from an XSL stylesheet. We
>> restructured the Java class, so that the operation could be performed
>> as a method call on an instance; the static method was changed to
>> create an instance of the class and make the instance method call.
>>
>> When we create an object instance and make the instance method call,
>> we do not have a concurrency problem. If we call the static method,
>> we have a concurrency problem. I reverified that the problem is
>> still there with the static method call after restructuring the class.
>>
>> What ever this problem is, it's tied up with how static Java method
>> calls are handled from the stylesheet versus instance method calls.
>> The static method call is reentrant; there should not have been a
>> problem. The problem appears to be tied up with how the parameters
>> are handled; in some instances it appears as though parameters from
>> one invocation are mixed up with another (presumably from another
>> thread). If I were to hazard a guess, on static Java method calls
>> the parameters are being maintained in a static structure.
>>
>> I won't be researching this farther, since will be using the instance
>> method call. As I've said before, company proprietary policies won't
>> allow me to provide source. Our test driver is running 10 threads on
>> a 8 CPU platform.
>>
>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Concurrency problems reproduced - what now.
Posted by Brian Minchau <mi...@ca.ibm.com>.
Ed,
please open separate JIRA issues, it is easy to mark one as a duplicate of
the other should that turn out to be the case.
This way each issue can have its own status, rather than tangling them
together. A single zip file, or separate attachements is fine, what ever
is best for you.
----------
Brian Minchau
XSLT Development, IBM Toronto
e-mail: minchau@ca.ibm.com
"Edward L. Knoll"
<ed.knoll@cosd.fe
dex.com> To
xalan-dev@xml.apache.org
01/12/2005 02:58 cc
PM
Subject
Concurrency problems reproduced -
Please respond to what now.
xalan-dev
I've reproduced the three major types of concurrency problems we
encountered with Xalan-Java 2.6.0 with fairly small elements for which I
can supply the source. One problem is an HTML serialization problem
which has likely been resolved, but I will supply anyway, so someone can
verify. The other two problems may turn out to be different aspects of
the same problem, since they both appear to revolve around management of
local variables within templates.
Do you want these packaged as a single defect?
How do you want the source: multiple text file attachments or a single
tar file? The components include a Java class/program, XSL stylesheets,
XML file(s), and the scripts I use to run the tests and cross compare
results to identify the errors.
I still have some cleanup and (re)packaging to do before I submit these,
but these activities should be completed soon.
Thanks,
Ed Knoll
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Concurrency problems reproduced - what now.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
I've reproduced the three major types of concurrency problems we
encountered with Xalan-Java 2.6.0 with fairly small elements for which I
can supply the source. One problem is an HTML serialization problem
which has likely been resolved, but I will supply anyway, so someone can
verify. The other two problems may turn out to be different aspects of
the same problem, since they both appear to revolve around management of
local variables within templates.
Do you want these packaged as a single defect?
How do you want the source: multiple text file attachments or a single
tar file? The components include a Java class/program, XSL stylesheets,
XML file(s), and the scripts I use to run the tests and cross compare
results to identify the errors.
I still have some cleanup and (re)packaging to do before I submit these,
but these activities should be completed soon.
Thanks,
Ed Knoll
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Concurrency problems with variable management?
Posted by Christine Li <jy...@ca.ibm.com>.
Hi, Edward
Thanks for trying to identify the problem. Once you can reproduce the
problem, please one a bug report and attach a test case to demonstrate the
problem http://nagoya.apache.org/jira/
Thanks,
Christine Li
XSLT Development
IBM Toronto Lab
Tel: (905)413-2601
Email: jycli@ca.ibm.com
"Edward L. Knoll" <ed...@cosd.fedex.com>
12/23/2004 02:49 PM
Please respond to
xalan-dev
To
xalan-dev@xml.apache.org
cc
Subject
Concurrency problems with variable management?
We seem to have isolated a couple of concurrency problems to the
handling of (template scope) variables in two different contexts. I
will include code fragments to illustrate the problems. Corporate
proprietary policies will not allow me to send the entire source or the
data. Within the next couple of weeks it is my intent to attempt to
reproduce both of these problems with simple/benign examples which (if
successful) I will submit with a bug report.
Our thread test driver is running 20 threads on a 8 processor box. Each
thread is performing the same set of 16 different transformations (in a
couple of different orders). Each transformation is performed by a SAX
processing chain. The XSL transforms are loaded into templates. The
classes used in the SAX processing chain are recreated for each
transformation.
In the first example, a local variable is passed to two separate
templates. The value of the IntermediateValue variable changes between
the two xsl:call-template invocations. The incorrect value can be found
in the input XML. We believe the incorrect value is being picked up
from another thread. This error will generally occur once or twice
every 10 runs (of the 20 threads).
<xsl:template match="sep-gmt-post-timestamp" priority="20.0">
<xsl:variable name="IntermediateValue"
select="concat(normalize-space(.),
substring-after(../event-creation-timestamp,'Z'))" />
<xsl:call-template name='TransformField'>
<xsl:with-param name="IntermediateValue"
select="$IntermediateValue" />
<xsl:with-param name="OtherElements">
<xsl:call-template name="FormatDateTime">
<xsl:with-param name="Input">
<xsl:value-of select="$IntermediateValue" />
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
The other error occurred on almost every test run. A local variable
inside of a recursive template call appeared to be changing. The
"count" was sometimes '1' when it should have been '0'. We totally
eliminated the local variables and the problem when away. I've included
old and new code fragments:
<!--Original/Broken Code-->
<xsl:template name="OutputFieldAndValue">
<xsl:param name="count" />
....
<xsl:variable name="paddingSpaces">
<xsl:value-of select="$num * 4" />
</xsl:variable>
....
<xsl:variable name="calculatedPadding">
<xsl:value-of
select="substring($TranslatedSpaces,1,$paddingSpaces)" />
</xsl:variable>
....
<xsl:for-each select="*">
<xsl:call-template name="OutputFieldAndValue">
<xsl:with-param name="count" select="$count+1" />
</xsl:call-template>
</xsl:for-each>
....
</xsl:template>
<!--New/Working Code-->
<xsl:template name="OutputFieldAndValue">
<xsl:param name="count" select="0" />
<xsl:param name="indent" select="''" />
....
<xsl:for-each select="*">
<xsl:call-template name="OutputFieldAndValue">
<xsl:with-param name="count" select="$count+1" />
<xsl:with-param name="indent"
select="substring($TranslatedSpaces,1,$count*4)" />
</xsl:call-template>
</xsl:for-each>
....
</xsl:template>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Concurrency problems with variable management?
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
We seem to have isolated a couple of concurrency problems to the
handling of (template scope) variables in two different contexts. I
will include code fragments to illustrate the problems. Corporate
proprietary policies will not allow me to send the entire source or the
data. Within the next couple of weeks it is my intent to attempt to
reproduce both of these problems with simple/benign examples which (if
successful) I will submit with a bug report.
Our thread test driver is running 20 threads on a 8 processor box. Each
thread is performing the same set of 16 different transformations (in a
couple of different orders). Each transformation is performed by a SAX
processing chain. The XSL transforms are loaded into templates. The
classes used in the SAX processing chain are recreated for each
transformation.
In the first example, a local variable is passed to two separate
templates. The value of the IntermediateValue variable changes between
the two xsl:call-template invocations. The incorrect value can be found
in the input XML. We believe the incorrect value is being picked up
from another thread. This error will generally occur once or twice
every 10 runs (of the 20 threads).
<xsl:template match="sep-gmt-post-timestamp" priority="20.0">
<xsl:variable name="IntermediateValue"
select="concat(normalize-space(.),
substring-after(../event-creation-timestamp,'Z'))" />
<xsl:call-template name='TransformField'>
<xsl:with-param name="IntermediateValue"
select="$IntermediateValue" />
<xsl:with-param name="OtherElements">
<xsl:call-template name="FormatDateTime">
<xsl:with-param name="Input">
<xsl:value-of select="$IntermediateValue" />
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
The other error occurred on almost every test run. A local variable
inside of a recursive template call appeared to be changing. The
"count" was sometimes '1' when it should have been '0'. We totally
eliminated the local variables and the problem when away. I've included
old and new code fragments:
<!--Original/Broken Code-->
<xsl:template name="OutputFieldAndValue">
<xsl:param name="count" />
....
<xsl:variable name="paddingSpaces">
<xsl:value-of select="$num * 4" />
</xsl:variable>
....
<xsl:variable name="calculatedPadding">
<xsl:value-of
select="substring($TranslatedSpaces,1,$paddingSpaces)" />
</xsl:variable>
....
<xsl:for-each select="*">
<xsl:call-template name="OutputFieldAndValue">
<xsl:with-param name="count" select="$count+1" />
</xsl:call-template>
</xsl:for-each>
....
</xsl:template>
<!--New/Working Code-->
<xsl:template name="OutputFieldAndValue">
<xsl:param name="count" select="0" />
<xsl:param name="indent" select="''" />
....
<xsl:for-each select="*">
<xsl:call-template name="OutputFieldAndValue">
<xsl:with-param name="count" select="$count+1" />
<xsl:with-param name="indent"
select="substring($TranslatedSpaces,1,$count*4)" />
</xsl:call-template>
</xsl:for-each>
....
</xsl:template>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Concurrency problem with static Java calls.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
Spoke to soon. The incident rate dropped a lot, but the problem still
persistes.
Edward L. Knoll wrote:
> Context: Xalan-J, 2.6.0; SAX transformation chain.
>
> We were having a concurrency operation associated with a call to a
> static Java method we were making from an XSL stylesheet. We
> restructured the Java class, so that the operation could be performed
> as a method call on an instance; the static method was changed to
> create an instance of the class and make the instance method call.
>
> When we create an object instance and make the instance method call,
> we do not have a concurrency problem. If we call the static method,
> we have a concurrency problem. I reverified that the problem is still
> there with the static method call after restructuring the class.
>
> What ever this problem is, it's tied up with how static Java method
> calls are handled from the stylesheet versus instance method calls.
> The static method call is reentrant; there should not have been a
> problem. The problem appears to be tied up with how the parameters are
> handled; in some instances it appears as though parameters from one
> invocation are mixed up with another (presumably from another
> thread). If I were to hazard a guess, on static Java method calls the
> parameters are being maintained in a static structure.
>
> I won't be researching this farther, since will be using the instance
> method call. As I've said before, company proprietary policies won't
> allow me to provide source. Our test driver is running 10 threads on
> a 8 CPU platform.
>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
More concurrency problems ....
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
Another concurrency issue has been isolated to a recursive XSL
template. This template has a (local) variable established using a
count passed to the template. The variable is an indent string; the
parameter is a number used to determine the amount of indent. Very
infrequently the indent string (variable) doesn't match the count
(parameter).
We've also encountered an output discrepancy in serialized XML output;
we've seen this once over a very large number of runs. The was a known
problem associated with HTML serialization and most of those issues
disappeared when we replaced the HTML Serializer with our own. We'll
try that with the XML Serializer.
I'm beginning to feel like I'm herding cats. I'm not sharing any XML
parsers, ContentHandlers, TransformHandlers, or Serializes between
threads. Is there anything else I should be doing to improve concurrent
behavior?
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Concurrency problem with static Java calls.
Posted by Morris Kwan <mk...@ca.ibm.com>.
Hi, Edward
You can open a bug in the JIRA database
(http://nagoya.apache.org/jira/secure/Dashboard.jspa).
Please attach the description here in the bug report. It might be difficult
to diagnose the problem without a testcase. If possible, please also
describe the types of the parameters, in case the problem is related to the
parameter types.
Thanks.
Morris Kwan
XSLT Development
IBM Toronto Lab
Tel: (905)413-3729
Email: mkwan@ca.ibm.com
"Edward L. Knoll"
<ed.knoll@cosd.fe
dex.com> To
xalan-dev@xml.apache.org
12/17/2004 10:41 cc
AM
Subject
Concurrency problem with static
Please respond to Java calls.
xalan-dev
Context: Xalan-J, 2.6.0; SAX transformation chain.
We were having a concurrency operation associated with a call to a
static Java method we were making from an XSL stylesheet. We
restructured the Java class, so that the operation could be performed as
a method call on an instance; the static method was changed to create an
instance of the class and make the instance method call.
When we create an object instance and make the instance method call, we
do not have a concurrency problem. If we call the static method, we
have a concurrency problem. I reverified that the problem is still
there with the static method call after restructuring the class.
What ever this problem is, it's tied up with how static Java method
calls are handled from the stylesheet versus instance method calls. The
static method call is reentrant; there should not have been a problem.
The problem appears to be tied up with how the parameters are handled;
in some instances it appears as though parameters from one invocation
are mixed up with another (presumably from another thread). If I were
to hazard a guess, on static Java method calls the parameters are being
maintained in a static structure.
I won't be researching this farther, since will be using the instance
method call. As I've said before, company proprietary policies won't
allow me to provide source. Our test driver is running 10 threads on a
8 CPU platform.
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Concurrency problem with static Java calls.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
Context: Xalan-J, 2.6.0; SAX transformation chain.
We were having a concurrency operation associated with a call to a
static Java method we were making from an XSL stylesheet. We
restructured the Java class, so that the operation could be performed as
a method call on an instance; the static method was changed to create an
instance of the class and make the instance method call.
When we create an object instance and make the instance method call, we
do not have a concurrency problem. If we call the static method, we
have a concurrency problem. I reverified that the problem is still
there with the static method call after restructuring the class.
What ever this problem is, it's tied up with how static Java method
calls are handled from the stylesheet versus instance method calls. The
static method call is reentrant; there should not have been a problem.
The problem appears to be tied up with how the parameters are handled;
in some instances it appears as though parameters from one invocation
are mixed up with another (presumably from another thread). If I were
to hazard a guess, on static Java method calls the parameters are being
maintained in a static structure.
I won't be researching this farther, since will be using the instance
method call. As I've said before, company proprietary policies won't
allow me to provide source. Our test driver is running 10 threads on a
8 CPU platform.
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Other concurrency issues ....
Posted by Brian Minchau <mi...@ca.ibm.com>.
Edward,
with SAX output one of three classes can get involved:
ToXMLSAXHandler
ToHTMLSAXHandler
ToTextSAXHandler
If Xalan "knows" from the <xsl:output> method attribute what the output
type is, we take advantage of that.
For example the ToTextSAXHandler will pretty much ignore
startElement/endElement calls, and this is an optimization earlier on in
output chain.
I can't remember exactly what, but ToXMLSAXHandler and ToHTMLSAXHandler
also differ. If you are providing your own ContentHandler implementation
then there is a conversion from SAX-like to SAX method calls going on here
with one of the 3 classes mentioned above. Without more information on what
your anomalous behavior is, and what your set-up is, I can't say more.
----------
Brian Minchau
XSLT Development, IBM Toronto
e-mail: minchau@ca.ibm.com
"Edward L. Knoll"
<ed.knoll@cosd.fe
dex.com> To
xalan-dev@xml.apache.org
12/16/2004 10:47 cc
AM
Subject
Other concurrency issues ....
Please respond to
xalan-dev
While we appear to have resolved our two biggest concurrency issues, I
still have a couple of lingering problems I'm trying to
characterize/isolate.
Does anyone know of any concurrency problems related to the XSL
extension mechanism for accessing/calling Java classes/methods? We're
accessing a class we've demonstrated to be thread safe in another
context. We're accessing that class through a wrapper, so the problem
could be there although I currently can't see it.
Even using our own HTML serializer, we're getting some anomalous output
in the final HTML. Does anyone know whether a <xsl:output ...>
statement in the stylesheet is going to have any affect on the XSL
processing (using a SAX TransformHandler) if we don't have a standard
(HTML) Serialize in our SAX processing chain?
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Other concurrency issues ....
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
While we appear to have resolved our two biggest concurrency issues, I
still have a couple of lingering problems I'm trying to
characterize/isolate.
Does anyone know of any concurrency problems related to the XSL
extension mechanism for accessing/calling Java classes/methods? We're
accessing a class we've demonstrated to be thread safe in another
context. We're accessing that class through a wrapper, so the problem
could be there although I currently can't see it.
Even using our own HTML serializer, we're getting some anomalous output
in the final HTML. Does anyone know whether a <xsl:output ...>
statement in the stylesheet is going to have any affect on the XSL
processing (using a SAX TransformHandler) if we don't have a standard
(HTML) Serialize in our SAX processing chain?
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Concurrency issue ....
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
We have a custom ContentHandler in a SAX processing chain which we use
to filter for nodes we wish to pass on. The filter is defined via a XML
file which we read into a NodeList. Since the filter definition is
static and we are only reading the NodeList, we set the filter up to be
shared between instances of the associated ContentHandler.
We are (intermittently) getting exceptions within the
NodeList.getLength() method. I don't know if our expectations are
inappropriate or if there is some problem buried within this NodeList
method/class.
If it is a problem, I can't supply source/data (company proprietary
policies), so I hope that's enough to go on.
I will be working on an alternate implementation, so am not looking for
resolution (although suggestions are welcome, if timely :).
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: question .... Resolved
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
Figured out. I was expecting to see the " " sequence from the
source coming through since that's what the HRML Serializer was
outputting. As it turned out, a '\u00A0' value was coming through.
Edward L. Knoll wrote:
> We have a SAX transformation chain that terminates with HTML output.
> Because we work in a multi-threaded context and because there is a
> concurrency issue with the Xalan-J 2.6.0 HTML serialization, we are
> (attempting) to introduce our own (simple) HTML serializer as a SAX
> ContentHandler.
>
> We've run into a problem with non-breaking spaces. Some of our XSL
> stylesheets need to output ' ' sequences, so those XSL
> stylesheets containing the following statement, so they can include
> ' ' inline:
>
> <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
>
> None of the ' ' sequences are making it through our
> ContentHandler/serializer; they do make it through a Serializer
> configured for HTML output.
>
> I'd appreciate any information regarding how to resolve this problem.
>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
question ....
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
We have a SAX transformation chain that terminates with HTML output.
Because we work in a multi-threaded context and because there is a
concurrency issue with the Xalan-J 2.6.0 HTML serialization, we are
(attempting) to introduce our own (simple) HTML serializer as a SAX
ContentHandler.
We've run into a problem with non-breaking spaces. Some of our XSL
stylesheets need to output ' ' sequences, so those XSL stylesheets
containing the following statement, so they can include ' ' inline:
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
None of the ' ' sequences are making it through our
ContentHandler/serializer; they do make it through a Serializer
configured for HTML output.
I'd appreciate any information regarding how to resolve this problem.
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Threading / concurrency problem.
Posted by Brian Minchau <mi...@ca.ibm.com>.
Hi, Ed:
This also reminds me of XALANJ-1861.
http://nagoya.apache.org/jira/secure/ViewIssue.jspa?key=XALANJ-1861
This fix would be in the current CVS but not in 2.6.0
----------
Brian Minchau
XSLT Development, IBM Toronto
e-mail: minchau@ca.ibm.com
Henry
Zongaro/Toronto/I
BM@IBMCA To
xalan-dev@xml.apache.org
12/07/2004 11:32 cc
AM
Subject
Re: Threading / concurrency
Please respond to problem.
xalan-dev
Hi, Ed.
"Edward L. Knoll" <ed...@cosd.fedex.com> wrote on 2004-12-06 01:19:14
PM:
> We have a class that puts together a SAX processing chain. We have put
> together a threaded test driver to exercise instances of this class
> concurrently and we're seeing some anomalous behavior involving
> whitespace. We're seeing extra line breaks and non breaking spaces
> introduced into the final output stream.
>
> Each instance of this class has it's own instances of the core
> processing components:
>
> - Serializer (up to three instances per transformation thread)
> - XMLReader (never more than one per thread)
> - TransformerHandlers (up to two per transformation thread)
> - custom classes implementing the ContentHandler interface
>
> The only (static) class instances (knowingly) shared across these
> threads are:
>
> - Templates for different transformations we may perform.
> - Property generated from OutputPropertiesFactory configured for XML
output.
> - Property generated from OutputPropertiesFactory configured for HTML
> output..
From your description, it sounds like you're putting together the
pieces in a way that ought to be thread-safe.
I took a quick look at the classes that implement serialization, and I
notice that the Serializer.setOutputFormat(Properties) maintains a
reference to the argument Properties object that is passed in, as opposed
to making a copy of it. Is it possible that your code makes changes to the
Properties object that's produced by OutputPropertiesFactory before passing
it to Serializer.setOutputFormat at the same time that some other
Serializer is using that same Properties object?
I'm not saying that it's right or wrong for
Serializer.setOutputFormat(Properties) to use a reference to the Properties
object - just making an observation.
Thanks,
Henry
------------------------------------------------------------------
Henry Zongaro Xalan development
IBM SWS Toronto Lab T/L 969-6044; Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Threading / concurrency problem.
Posted by Henry Zongaro <zo...@ca.ibm.com>.
Hi, Ed.
"Edward L. Knoll" <ed...@cosd.fedex.com> wrote on 2004-12-06 01:19:14
PM:
> We have a class that puts together a SAX processing chain. We have put
> together a threaded test driver to exercise instances of this class
> concurrently and we're seeing some anomalous behavior involving
> whitespace. We're seeing extra line breaks and non breaking spaces
> introduced into the final output stream.
>
> Each instance of this class has it's own instances of the core
> processing components:
>
> - Serializer (up to three instances per transformation thread)
> - XMLReader (never more than one per thread)
> - TransformerHandlers (up to two per transformation thread)
> - custom classes implementing the ContentHandler interface
>
> The only (static) class instances (knowingly) shared across these
> threads are:
>
> - Templates for different transformations we may perform.
> - Property generated from OutputPropertiesFactory configured for XML
output.
> - Property generated from OutputPropertiesFactory configured for HTML
> output..
From your description, it sounds like you're putting together the
pieces in a way that ought to be thread-safe.
I took a quick look at the classes that implement serialization, and
I notice that the Serializer.setOutputFormat(Properties) maintains a
reference to the argument Properties object that is passed in, as opposed
to making a copy of it. Is it possible that your code makes changes to
the Properties object that's produced by OutputPropertiesFactory before
passing it to Serializer.setOutputFormat at the same time that some other
Serializer is using that same Properties object?
I'm not saying that it's right or wrong for
Serializer.setOutputFormat(Properties) to use a reference to the
Properties object - just making an observation.
Thanks,
Henry
------------------------------------------------------------------
Henry Zongaro Xalan development
IBM SWS Toronto Lab T/L 969-6044; Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com
Threading / concurrency problem.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
We have a class that puts together a SAX processing chain. We have put
together a threaded test driver to exercise instances of this class
concurrently and we're seeing some anomalous behavior involving
whitespace. We're seeing extra line breaks and non breaking spaces
introduced into the final output stream.
Each instance of this class has it's own instances of the core
processing components:
- Serializer (up to three instances per transformation thread)
- XMLReader (never more than one per thread)
- TransformerHandlers (up to two per transformation thread)
- custom classes implementing the ContentHandler interface
The only (static) class instances (knowingly) shared across these
threads are:
- Templates for different transformations we may perform.
- Property generated from OutputPropertiesFactory configured for XML output.
- Property generated from OutputPropertiesFactory configured for HTML
output..
None for our final output is mangled or missing; we just seem to have
extra whitespace. A transformation sequence might capture the raw XML
input to a file, capture a generated intermediate XML form to a file,
and/or capture a final HTML display output to a file. All of the
discrepancies so far have been in the final HTML output.
We have never seen any differences in the output from run to run doing
these transformations in a single thread. Running in three threads has
generated discrepancies, but not consistently. Running with six threads
seems to consistently generate discrepancies. The discrepancies are not
predictable or consistent from run to run.
My understanding is that Templates should be thread safe and I would not
expect the Property objects returned from OutputPropertiesFactory to be
a problem.
I'd appreciate any light anyone might be able to shed on this problem.
Thanks,
Ed Knoll
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Problem with Transformer.setParameter() in SAX chain.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
Thanks for all the feedback I received. It helped me understand why I
had a problem and led me to a solution. The XSL Transformation could
not be incremental; it would have to collect the entire tree before
processing and then it would use what ever value the parameter had at
the time. I would hazard this processing is triggered by the
ContentHandler.endDocument() event.
The solution I went with was to create a custom ContentHandler to use
when each of the raw XML streams was being processed. This
ContentHandler looked for a specific element and then introduced a new
element with the value I was trying to set by parameter.
>I have chain of Sax handlers which is effectively a XMLReader chained to
>SAXTransformer chained to a custom ContentHandler chained to a
>Serializer. I am actually parsing multiple XML input streams to
>generate a single output XML stream. The custom Content Handler
>suppresses all but the first startDocument() event and the last
>endDocument() event to keep the Serializer which is generating the
>single XML output from getting upset.
>
>This is the net chain; my actually chain contains some custom "tee"
>ContentHandlers and additional flows of SAX events, but I don't believe
>those to be germane to my problem.
>
>I need to change a parameter with the SAXTransformer for each file
>processed. This parameter is used to generate an output element for
>each file processed. I can do a setParameter() followed by a
>getParameter() and see that the parameter is changed in the Transformer.
> This is done for each file before doing a XMLReader.parse().
>
>My problem is that the elements in the output XML which represent this
>changing parameter only have the last value this parameter was set to.
>I've tried doing a Transformer.clearParameters() between
>XMLReader.parse() actions, but that appears to have no affect.
>
>I would think that each XMLReader.parse() execution and so each XSL
>Transformation would be independent of each other. I don't see how
>anything other than the value of this changing parameter can be
>propagating through the custom ContentHandler given the signatures of
>the ContentHandler methods.
>
>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Problem with Transformer.setParameter() in SAX chain.
Posted by Brian Minchau <mi...@ca.ibm.com>.
Ed,
Your setParameter() need to be made before "the" transformation starts,
effectively sets a global xsl:param in your stylesheet. However once the
transformation has started you can't change the value of global stylesheet
variables in the middle of a transformation. You are going to need multiple
transformations and do the setParameter() on each one before the
transformation starts. But you should be able to concatenate your output by
reusing the output Writer or OutputStream from one transformation to the
next.
How about this. You have created the java.io.Writer or a
java.io.OutputStream. You can use the org.apache.xml.serializer.Serializer
interface to set either your Writer or your OutputStream. Run each of your
documents through your stream with a startDocument and endDocument. For the
first document let it write out the XML header. For subsequent documents
you can call the reset() method on the serializer, or get a new Serializer,
but you should be able to reuse that serializer (you might have to
setWriter() with the same writer ...). Also for subsequent transformations
you need to set the property on the serializer to omit the xml header:
java.util.Properties p = new Properties();
p.setProperty("omit-xml-header", "yes");
Serializer.setOutputFormat(p);
For each transformation leading into this serializer you should be able to
setParameter().
----------
Brian Minchau
XSLT Development, IBM Toronto
e-mail: minchau@ca.ibm.com
"Edward L. Knoll"
<ed.knoll@cosd.fe
dex.com> To
xalan-dev@xml.apache.org
10/20/2004 08:00 cc
PM
Subject
Problem with
Please respond to Transformer.setParameter() in SAX
xalan-dev chain.
I have chain of Sax handlers which is effectively a XMLReader chained to
SAXTransformer chained to a custom ContentHandler chained to a
Serializer. I am actually parsing multiple XML input streams to
generate a single output XML stream. The custom Content Handler
suppresses all but the first startDocument() event and the last
endDocument() event to keep the Serializer which is generating the
single XML output from getting upset.
This is the net chain; my actually chain contains some custom "tee"
ContentHandlers and additional flows of SAX events, but I don't believe
those to be germane to my problem.
I need to change a parameter with the SAXTransformer for each file
processed. This parameter is used to generate an output element for
each file processed. I can do a setParameter() followed by a
getParameter() and see that the parameter is changed in the Transformer.
This is done for each file before doing a XMLReader.parse().
My problem is that the elements in the output XML which represent this
changing parameter only have the last value this parameter was set to.
I've tried doing a Transformer.clearParameters() between
XMLReader.parse() actions, but that appears to have no affect.
I would think that each XMLReader.parse() execution and so each XSL
Transformation would be independent of each other. I don't see how
anything other than the value of this changing parameter can be
propagating through the custom ContentHandler given the signatures of
the ContentHandler methods.
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Problem with Transformer.setParameter() in SAX chain.
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
I have chain of Sax handlers which is effectively a XMLReader chained to
SAXTransformer chained to a custom ContentHandler chained to a
Serializer. I am actually parsing multiple XML input streams to
generate a single output XML stream. The custom Content Handler
suppresses all but the first startDocument() event and the last
endDocument() event to keep the Serializer which is generating the
single XML output from getting upset.
This is the net chain; my actually chain contains some custom "tee"
ContentHandlers and additional flows of SAX events, but I don't believe
those to be germane to my problem.
I need to change a parameter with the SAXTransformer for each file
processed. This parameter is used to generate an output element for
each file processed. I can do a setParameter() followed by a
getParameter() and see that the parameter is changed in the Transformer.
This is done for each file before doing a XMLReader.parse().
My problem is that the elements in the output XML which represent this
changing parameter only have the last value this parameter was set to.
I've tried doing a Transformer.clearParameters() between
XMLReader.parse() actions, but that appears to have no affect.
I would think that each XMLReader.parse() execution and so each XSL
Transformation would be independent of each other. I don't see how
anything other than the value of this changing parameter can be
propagating through the custom ContentHandler given the signatures of
the ContentHandler methods.
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Why does copy transform take so long?
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
I went through the Xalan-J SAX examples and I was looking for a
ContentManager or XMLFilter example which might show this, but I didn't
come across anything. Do you know of a 'SAX "tee" fitting'
implementation/example we could leverage?
Joseph Kesselman wrote:
>
>
>Xalan should be noticably more efficient when processing from a SAX or
>stream source (ie, when you let it build a DTM) than when processing from a
>DOM.
>
>Similarly, Xalan's native output is SAX. If you want to both serialize and
>further process, you might want to consider a SAX "tee" fitting -- a SAX
>stage which routes its input both to a serializer and to additional
>processing -- rather than building a DOM tree.
>
>None the less, your performance should be better than what you're
>reporting, unless you're in a situation where you're swapping yourself to
>death...
>
>______________________________________
>Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
>"The world changed profoundly and unpredictably the day Tim Berners Lee
>got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
>For additional commands, e-mail: xalan-dev-help@xml.apache.org
>
>
>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Why does copy transform take so long?
Posted by Joseph Kesselman <ke...@us.ibm.com>.
Xalan should be noticably more efficient when processing from a SAX or
stream source (ie, when you let it build a DTM) than when processing from a
DOM.
Similarly, Xalan's native output is SAX. If you want to both serialize and
further process, you might want to consider a SAX "tee" fitting -- a SAX
stage which routes its input both to a serializer and to additional
processing -- rather than building a DOM tree.
None the less, your performance should be better than what you're
reporting, unless you're in a situation where you're swapping yourself to
death...
______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Why does copy transform take so long?
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
The goal of this performance test was to attempt to characterize the
performance of our real XSL which transforms an input XML to an output
XML. Most of the input XML elements will appear in the output XML. A
significant percentage of the input XML elements are transformed; such
transforms always introduce child elements in the output XML.
My purposes in doing this test was to provide a lower bound on our
performance; we can not be faster then executing a simple transform
which copies input to output. Taking advantage of the built-in
identity transform wouldn't not support this evaluation.
We use the output DOM, because from this stage we will both (a)
serialize the output to a file and (b) apply a second transformation to
the output DOM.
The input DOM may not be strictly necessary for actual operation; we get
our input as a byte-array and I could use a stream source for the
input. However, for purposes of evaluating and isolating the different
contributors to the performance, I wanted to separate the time to parse
the input XML from the time to transform the input XML.
From my perspective (unless I'm missing something which is why I posted
here), this copy transform should represent the lower bound on our
performance.
Santiago Pericas-Geertsen wrote:
>
> On Sep 27, 2004, at 3:17 PM, Edward L. Knoll wrote:
>
>> I'm running on a Sun/Solaris platform. We're running Xalan-J 2.4 and
>> JDK 1.4. Our Java program does the following:
>> - loads the XSL style sheet into a javax.xml.transform.Templates,
>> - loads the XML file into a javax.xml.transform.dom.DOMSource
>> - transforms the DOMSource into a javax.xml.transform.dom.DOMResult
>> using javax.xml.transform.Transformer
>> - serializes the DOMResult to an output file using
>> org.apache.xml.serializer.Serializer
>
>
> Do you really need all these steps? This will create 3 DOMs in
> memory, the input, the output and the internal one created by Xalan
> (DTM). Seems unnecessary, but I don't know exactly what the app is doing.
>
>> The core template we're using for the copy is the following:
>>
>> <xsl:template name="CopyAll" match="*">
>> <xsl:copy>
>> <xsl:copy-of select="@*" />
>> <xsl:apply-templates />
>> </xsl:copy>
>> </xsl:template>
>
>
> Could you use the built-in identity transform instead? Not the same
> as the stylesheet above, but may have the same outcome depending on
> the XML files that you're processing --note that using the built-in
> identity transform will not require the creation of a DTM.
>
>> Following is a breakdown on the performance:
>> - loading the stylesheet : 1.7 seconds
>> - loading XML file : 0.3 seconds
>> - creating Transform instance from Transforms: <0.1 seconds
>> - serializing to output file: 0.4 seconds
>> - executing copy transform: 2.1 seconds
>
>
> Are these averages of multiple runs? These are awfully high numbers.
> Have you run this 100 or more times dropping the first few iterations
> to exclude class loading, etc.?
>
> -- Santiago
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xalan-dev-help@xml.apache.org
>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Why does copy transform take so long?
Posted by Santiago Pericas-Geertsen <Sa...@Sun.COM>.
On Sep 27, 2004, at 3:17 PM, Edward L. Knoll wrote:
> I'm running on a Sun/Solaris platform. We're running Xalan-J 2.4 and
> JDK 1.4. Our Java program does the following:
> - loads the XSL style sheet into a javax.xml.transform.Templates,
> - loads the XML file into a javax.xml.transform.dom.DOMSource
> - transforms the DOMSource into a javax.xml.transform.dom.DOMResult
> using javax.xml.transform.Transformer
> - serializes the DOMResult to an output file using
> org.apache.xml.serializer.Serializer
Do you really need all these steps? This will create 3 DOMs in memory,
the input, the output and the internal one created by Xalan (DTM).
Seems unnecessary, but I don't know exactly what the app is doing.
> The core template we're using for the copy is the following:
>
> <xsl:template name="CopyAll" match="*">
> <xsl:copy>
> <xsl:copy-of select="@*" />
> <xsl:apply-templates />
> </xsl:copy>
> </xsl:template>
Could you use the built-in identity transform instead? Not the same as
the stylesheet above, but may have the same outcome depending on the
XML files that you're processing --note that using the built-in
identity transform will not require the creation of a DTM.
> Following is a breakdown on the performance:
> - loading the stylesheet : 1.7 seconds
> - loading XML file : 0.3 seconds
> - creating Transform instance from Transforms: <0.1 seconds
> - serializing to output file: 0.4 seconds
> - executing copy transform: 2.1 seconds
Are these averages of multiple runs? These are awfully high numbers.
Have you run this 100 or more times dropping the first few iterations
to exclude class loading, etc.?
-- Santiago
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Why does copy transform take so long?
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
There are no explicit DTD references.
Joseph Kesselman wrote:
>I agree that this is surprising.
>
>Quick sanity check: Does the source document reference a DTD, and if so is
>it local or remote? Xalan normally parses with validation, since XSLT wants
>to know whether attributes are IDs or not, and time to fetch the DTD from a
>server might be impacting your results.
>
>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Why does copy transform take so long?
Posted by Joseph Kesselman <ke...@us.ibm.com>.
I agree that this is surprising.
Quick sanity check: Does the source document reference a DTD, and if so is
it local or remote? Xalan normally parses with validation, since XSLT wants
to know whether attributes are IDs or not, and time to fetch the DTD from a
server might be impacting your results.
______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Why does copy transform take so long?
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
We are working through some performance issues and I thought I'd check
how long a simple copy transformation (copy input XML to output XML)
takes. It's taking much longer than we expected. At this point, we're
wondering if we're missing something in the setup or execution of our
XSL processing.
I'm running on a Sun/Solaris platform. We're running Xalan-J 2.4 and
JDK 1.4. Our Java program does the following:
- loads the XSL style sheet into a javax.xml.transform.Templates,
- loads the XML file into a javax.xml.transform.dom.DOMSource
- transforms the DOMSource into a javax.xml.transform.dom.DOMResult
using javax.xml.transform.Transformer
- serializes the DOMResult to an output file using
org.apache.xml.serializer.Serializer
The core template we're using for the copy is the following:
<xsl:template name="CopyAll" match="*">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
Following is a breakdown on the performance:
- loading the stylesheet : 1.7 seconds
- loading XML file : 0.3 seconds
- creating Transform instance from Transforms: <0.1 seconds
- serializing to output file: 0.4 seconds
- executing copy transform: 2.1 seconds
Characteristics of the input XML file:
- LineCount: 9678
- ByteCount: 494668
- TotalElementCount: 8795
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Memory issue: can I force garbage collection in xslt.Process? (WORKING)
Posted by Joseph Kesselman <ke...@us.ibm.com>.
Glad that solved it for you. At some point, someone needs to come up with a
better cache management algorithm for Xalan. Unfortunately, in the general
case it's a Stopping Problem to determine whether document() will ever be
issued again with the same URI. We've considered coming up with some sort
of extension to let you hint whether a document is worth caching or not,
but it hasn't come to the top of anyone's priority queue recently.
______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Memory issue: can I force garbage collection in xslt.Process?
(WORKING)
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
The referenced XML documents I was loading/processing during operation
of the primary XML document were being cached. Although I only used
each document once within the scope of single template, the XSL
processor in general couldn't know this. I found a reference in the FAQ
with regards to memory problems processing multiple documents and it
showed a mechanism for turning the document caching off. The example is
in the context of the for-each which I didn't have and don't need, but I
couldn't seem to get this to work without it. However, I did
restructure my template to have a for-each (to handle a single document)
and was able to get things to work.
Following is the example code from the FAQ for those interested:
><xsl:template match="doc">
> <xsl:for-each select="document(@href)/bar/zulu">
> <?xalan-doc-cache-off?>
> <!-- process each document -->
> <xsl:for-each>
></xsl:template>
>
Joseph Kesselman wrote:
>
>
>Java GC should run automatically as memory gets scarce, so it probably is
>NOT your issue. (And note that Java never lets you "force" garbage
>collection; the most you can do is hint that "you might want to do it now
>rather than waiting until later").
>
>How deep is the recursion in your stylesheet? How many layers of variables
>are piling up? How many documents are you referencing (normally, they're
>all cached in memory until the transformation ends)?
>
>
>______________________________________
>Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
>"The world changed profoundly and unpredictably the day Tim Berners Lee
>got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
>For additional commands, e-mail: xalan-dev-help@xml.apache.org
>
>
>
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Memory issue: can I force garbage collection in xslt.Process?
Posted by Joseph Kesselman <ke...@us.ibm.com>.
Java GC should run automatically as memory gets scarce, so it probably is
NOT your issue. (And note that Java never lets you "force" garbage
collection; the most you can do is hint that "you might want to do it now
rather than waiting until later").
How deep is the recursion in your stylesheet? How many layers of variables
are piling up? How many documents are you referencing (normally, they're
all cached in memory until the transformation ends)?
______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Memory issue: can I force garbage collection in xslt.Process?
Posted by "Edward L. Knoll" <ed...@cosd.fedex.com>.
Is there any way to force org.apache.xalan.xslt.Process to do memory
cleanup during processing?
I'm processing an XML file which contains, among other things,
references to other XML files. My XSL style sheet contains a template
to process an element referencing a XML file, loads the referenced XML
document (using document) into a variable in the template, extracts some
data from that referenced XML, and then exits the template.
It appears as though those loaded documents are not being released (very
effectively), because I die with a Java java.lang.OutOfMemoryError
exception during processing while loading one of those embedded XML
files (which is not one the biggest processed).
The output XML is only at 8471 lines/elements large when the process
dies; I've generated much larger output XML files, so I'm sure the
problem isn't with the XML I'm generating either.
Thanks,
Ed Knoll
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Question regarding use of indent-amount with Serializers.
Posted by Joseph Kesselman <ke...@us.ibm.com>.
There was recent debate about this in Bugzilla.
If you're outputting to DOM or SAX, according to some authorities, this
will copy from the raw Result Tree and the settings in xsl:output do not
affect it. To get indentation from that point, you have to route the DOM or
SAX data through a filter or serializer that knows how to indent.
I don't much like that answer; I'd rather have the option of being able to
get fully styled output to an API without having to reprocess. However,
this result-tree-only behavior does seem to be how the TrAX APIs were
defined.
As they say in Maine, "You can't get there from here."
______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
Re: Question regarding use of indent-amount with Serializers via JAXP
Posted by Brian Minchau <mi...@ca.ibm.com>.
Ed Knoll:
I can't say that I've done this myself, but this is how I think it ought to
work.
This is not a standard JAXP property like others that map to the attributes
of <xsl:output ....>. In a stylesheet you would do something like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xslt">
<xsl:output method="xml"
encoding="UTF-8"
indent="yes"
xalan:indent-amount="2"/>
But how do you set the Xalan specific property with the given URI through
JAXP?
You will get a JAXP reference to a javax.xml.transform.Transformer at some
point in your code. Lets call the reference x. You should need code like
this:
String key = "{http://xml.apache.org/xalan}indent-amount";
String value = "2";
x.setOutputProperty(key,value);
Note the { and } around the URI in the key. The key should be what appears
in Xalan's xml_output.properties file (or other similar files).
There may be a bug in there yet, but give this a try.
----------
Brian Minchau
XSLT Development, IBM Toronto
e-mail: minchau@ca.ibm.com
"Edward L. Knoll"
<ed.knoll@cosd.fe
dex.com> To
xalan-dev@xml.apache.org
08/25/2004 05:09 cc
PM
Subject
Question regarding use of
Please respond to indent-amount with Serializers.
xalan-dev
I was successfully using the indent-amount attribute in a stylesheet
when I was using org.apache.xalan.xslt.Process to process the
stylesheet. I'm now processing the stylesheet (from Java) using a
Transformer class with output to a DOMResult class and then using a
(xml) Serializer class to write the DOMResult to a file. I have not
been able to figure out how to control the indent-amount in this context.
Does the indent-amount work in this context, and if so, how do set it up?
Thanks,
Ed Knoll
--
Edward L. Knoll Phone (FedEx) : (719)484-2717
e-mail (FedEx) : edward.knoll@fedex.com
e-mail (personal) : edward@elknoll.com
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org