You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "arn44 (JIRA)" <xa...@xml.apache.org> on 2005/06/06 16:48:41 UTC
[jira] Created: (XALANJ-2140) Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
-------------------------------------------------------------------------------------
Key: XALANJ-2140
URL: http://issues.apache.org/jira/browse/XALANJ-2140
Project: XalanJ2
Type: Bug
Components: XSLTC
Versions: 2.6
Environment: windows jdk 1.4.2_06 xsltc
Reporter: arn44
Priority: Critical
Hello,
I have a problem with a stylesheet containing a xsl:key.
I have the impression that the Transformer object guard into memory preceding xml source.
Here a testcase to reproduce the problem.
The first transformation and the third should produce the same thing.
It is true with Xalan interpretive.
It is not the case in xsltc.
_________________________
package test;
import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.Properties;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
public class XSLTTest extends TestCase {
public XSLTTest(String arg0) {
super(arg0);
}
public void testKey() throws Exception {
String key = "javax.xml.transform.TransformerFactory";
String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
Properties props = System.getProperties();
props.put(key, value);
System.setProperties(props);
TransformerFactory tFactory = TransformerFactory.newInstance();
String xsl = getClass().getResource("test.xsl").getPath();
//1 transformation
Source xml = new StreamSource(new File(getClass()
.getResource("habP1.xml")
.getPath()));
ByteArrayOutputStream out = new ByteArrayOutputStream();
Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
transformer.transform(xml, new StreamResult(out));
System.out.println(out.toString());
//2 transformation
xml = new StreamSource(new File(getClass().getResource("habP0.xml")
.getPath()));
ByteArrayOutputStream out2 = new ByteArrayOutputStream();
transformer.transform(xml, new StreamResult(out2));
System.out.println(out2.toString());
//3 transformation
xml = new StreamSource(new File(getClass().getResource("habP1.xml")
.getPath()));
ByteArrayOutputStream out3 = new ByteArrayOutputStream();
transformer.transform(xml, new StreamResult(out3));
System.out.println(out3.toString());
assertEquals(out.toString(),out3.toString());
}
}
--------test.xsl----------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="ISO-8859-1" indent="yes" />
<xsl:key name="clef_habilitations" match ="action" use = "nom" />
<xsl:template match="/">
-<xsl:value-of select="key('clef_habilitations','nom1')/nom" />-
-<xsl:value-of select="key('clef_habilitations','nom2')/nom" />-
</xsl:template>
</xsl:stylesheet>
---------habP0.xml------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<habilitation>
<action>
<nom>nom1</nom>
</action>
<action>
<nom>nom2</nom>
</action>
<action>
<nom>nom3</nom>
</action>
<action>
<nom>nom4</nom>
</action>
</habilitation>
------------habP1.xml--------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<habilitation>
<action>
<nom>nom1</nom>
</action>
<action>
<nom>nom3</nom>
</action>
<action>
<nom>nom4</nom>
</action>
</habilitation>
----------System.out---------------------
-nom1-
--
-nom1-
-nom2-
-nom1-
-nom3-
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Commented: (XALANJ-2140) Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANJ-2140?page=comments#action_12319266 ]
Brian Minchau commented on XALANJ-2140:
---------------------------------------
arn44,
this bug is fixed and is now in the 2.7 release. You are the reporter, so please confirm that the issue is fixed so that we can close this issue.
> Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
> -------------------------------------------------------------------------------------
>
> Key: XALANJ-2140
> URL: http://issues.apache.org/jira/browse/XALANJ-2140
> Project: XalanJ2
> Type: Bug
> Components: XSLTC
> Versions: 2.6
> Environment: windows jdk 1.4.2_06 xsltc
> Reporter: arn44
> Assignee: Henry Zongaro
> Priority: Critical
> Fix For: 2.7
> Attachments: j2140.patch.txt
>
> Hello,
> I have a problem with a stylesheet containing a xsl:key.
> I have the impression that the Transformer object guard into memory preceding xml source.
> Here a testcase to reproduce the problem.
> The first transformation and the third should produce the same thing.
> It is true with Xalan interpretive.
> It is not the case in xsltc.
> _________________________
> package test;
> import junit.framework.TestCase;
> import java.io.ByteArrayOutputStream;
> import java.io.File;
> import java.util.Properties;
> import javax.xml.transform.Source;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
> public class XSLTTest extends TestCase {
> public XSLTTest(String arg0) {
> super(arg0);
> }
> public void testKey() throws Exception {
> String key = "javax.xml.transform.TransformerFactory";
> String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
> Properties props = System.getProperties();
> props.put(key, value);
> System.setProperties(props);
> TransformerFactory tFactory = TransformerFactory.newInstance();
> String xsl = getClass().getResource("test.xsl").getPath();
> //1 transformation
> Source xml = new StreamSource(new File(getClass()
> .getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
> transformer.transform(xml, new StreamResult(out));
> System.out.println(out.toString());
> //2 transformation
> xml = new StreamSource(new File(getClass().getResource("habP0.xml")
> .getPath()));
> ByteArrayOutputStream out2 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out2));
> System.out.println(out2.toString());
> //3 transformation
> xml = new StreamSource(new File(getClass().getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out3 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out3));
> System.out.println(out3.toString());
> assertEquals(out.toString(),out3.toString());
> }
> }
> --------test.xsl----------------------
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="text" encoding="ISO-8859-1" indent="yes" />
> <xsl:key name="clef_habilitations" match ="action" use = "nom" />
> <xsl:template match="/">
>
> -<xsl:value-of select="key('clef_habilitations','nom1')/nom" />-
> -<xsl:value-of select="key('clef_habilitations','nom2')/nom" />-
> </xsl:template>
> </xsl:stylesheet>
> ---------habP0.xml------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom2</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
> </habilitation>
> ------------habP1.xml--------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
>
> </habilitation>
> ----------System.out---------------------
>
> -nom1-
> --
>
>
>
> -nom1-
> -nom2-
>
>
>
> -nom1-
> -nom3-
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Closed: (XALANJ-2140) Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANJ-2140?page=all ]
Brian Minchau closed XALANJ-2140:
---------------------------------
Closing the issue, per Arnaud's (the reporter's) comment.
> Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
> -------------------------------------------------------------------------------------
>
> Key: XALANJ-2140
> URL: http://issues.apache.org/jira/browse/XALANJ-2140
> Project: XalanJ2
> Type: Bug
> Components: XSLTC
> Versions: 2.6
> Environment: windows jdk 1.4.2_06 xsltc
> Reporter: arnaud
> Assignee: Henry Zongaro
> Priority: Critical
> Fix For: 2.7
> Attachments: j2140.patch.txt
>
> Hello,
> I have a problem with a stylesheet containing a xsl:key.
> I have the impression that the Transformer object guard into memory preceding xml source.
> Here a testcase to reproduce the problem.
> The first transformation and the third should produce the same thing.
> It is true with Xalan interpretive.
> It is not the case in xsltc.
> _________________________
> package test;
> import junit.framework.TestCase;
> import java.io.ByteArrayOutputStream;
> import java.io.File;
> import java.util.Properties;
> import javax.xml.transform.Source;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
> public class XSLTTest extends TestCase {
> public XSLTTest(String arg0) {
> super(arg0);
> }
> public void testKey() throws Exception {
> String key = "javax.xml.transform.TransformerFactory";
> String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
> Properties props = System.getProperties();
> props.put(key, value);
> System.setProperties(props);
> TransformerFactory tFactory = TransformerFactory.newInstance();
> String xsl = getClass().getResource("test.xsl").getPath();
> //1 transformation
> Source xml = new StreamSource(new File(getClass()
> .getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
> transformer.transform(xml, new StreamResult(out));
> System.out.println(out.toString());
> //2 transformation
> xml = new StreamSource(new File(getClass().getResource("habP0.xml")
> .getPath()));
> ByteArrayOutputStream out2 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out2));
> System.out.println(out2.toString());
> //3 transformation
> xml = new StreamSource(new File(getClass().getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out3 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out3));
> System.out.println(out3.toString());
> assertEquals(out.toString(),out3.toString());
> }
> }
> --------test.xsl----------------------
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="text" encoding="ISO-8859-1" indent="yes" />
> <xsl:key name="clef_habilitations" match ="action" use = "nom" />
> <xsl:template match="/">
>
> -<xsl:value-of select="key('clef_habilitations','nom1')/nom" />-
> -<xsl:value-of select="key('clef_habilitations','nom2')/nom" />-
> </xsl:template>
> </xsl:stylesheet>
> ---------habP0.xml------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom2</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
> </habilitation>
> ------------habP1.xml--------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
>
> </habilitation>
> ----------System.out---------------------
>
> -nom1-
> --
>
>
>
> -nom1-
> -nom2-
>
>
>
> -nom1-
> -nom3-
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Updated: (XALANJ-2140) Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
Posted by "Henry Zongaro (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANJ-2140?page=all ]
Henry Zongaro updated XALANJ-2140:
----------------------------------
Attachment: j2140.patch.txt
> Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
> -------------------------------------------------------------------------------------
>
> Key: XALANJ-2140
> URL: http://issues.apache.org/jira/browse/XALANJ-2140
> Project: XalanJ2
> Type: Bug
> Components: XSLTC
> Versions: 2.6
> Environment: windows jdk 1.4.2_06 xsltc
> Reporter: arn44
> Priority: Critical
> Attachments: j2140.patch.txt
>
> Hello,
> I have a problem with a stylesheet containing a xsl:key.
> I have the impression that the Transformer object guard into memory preceding xml source.
> Here a testcase to reproduce the problem.
> The first transformation and the third should produce the same thing.
> It is true with Xalan interpretive.
> It is not the case in xsltc.
> _________________________
> package test;
> import junit.framework.TestCase;
> import java.io.ByteArrayOutputStream;
> import java.io.File;
> import java.util.Properties;
> import javax.xml.transform.Source;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
> public class XSLTTest extends TestCase {
> public XSLTTest(String arg0) {
> super(arg0);
> }
> public void testKey() throws Exception {
> String key = "javax.xml.transform.TransformerFactory";
> String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
> Properties props = System.getProperties();
> props.put(key, value);
> System.setProperties(props);
> TransformerFactory tFactory = TransformerFactory.newInstance();
> String xsl = getClass().getResource("test.xsl").getPath();
> //1 transformation
> Source xml = new StreamSource(new File(getClass()
> .getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
> transformer.transform(xml, new StreamResult(out));
> System.out.println(out.toString());
> //2 transformation
> xml = new StreamSource(new File(getClass().getResource("habP0.xml")
> .getPath()));
> ByteArrayOutputStream out2 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out2));
> System.out.println(out2.toString());
> //3 transformation
> xml = new StreamSource(new File(getClass().getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out3 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out3));
> System.out.println(out3.toString());
> assertEquals(out.toString(),out3.toString());
> }
> }
> --------test.xsl----------------------
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="text" encoding="ISO-8859-1" indent="yes" />
> <xsl:key name="clef_habilitations" match ="action" use = "nom" />
> <xsl:template match="/">
>
> -<xsl:value-of select="key('clef_habilitations','nom1')/nom" />-
> -<xsl:value-of select="key('clef_habilitations','nom2')/nom" />-
> </xsl:template>
> </xsl:stylesheet>
> ---------habP0.xml------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom2</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
> </habilitation>
> ------------habP1.xml--------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
>
> </habilitation>
> ----------System.out---------------------
>
> -nom1-
> --
>
>
>
> -nom1-
> -nom2-
>
>
>
> -nom1-
> -nom3-
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Commented: (XALANJ-2140) Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
Posted by "arn44 (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANJ-2140?page=comments#action_12320568 ]
arn44 commented on XALANJ-2140:
-------------------------------
it's ok.
You can close the issue
> Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
> -------------------------------------------------------------------------------------
>
> Key: XALANJ-2140
> URL: http://issues.apache.org/jira/browse/XALANJ-2140
> Project: XalanJ2
> Type: Bug
> Components: XSLTC
> Versions: 2.6
> Environment: windows jdk 1.4.2_06 xsltc
> Reporter: arn44
> Assignee: Henry Zongaro
> Priority: Critical
> Fix For: 2.7
> Attachments: j2140.patch.txt
>
> Hello,
> I have a problem with a stylesheet containing a xsl:key.
> I have the impression that the Transformer object guard into memory preceding xml source.
> Here a testcase to reproduce the problem.
> The first transformation and the third should produce the same thing.
> It is true with Xalan interpretive.
> It is not the case in xsltc.
> _________________________
> package test;
> import junit.framework.TestCase;
> import java.io.ByteArrayOutputStream;
> import java.io.File;
> import java.util.Properties;
> import javax.xml.transform.Source;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
> public class XSLTTest extends TestCase {
> public XSLTTest(String arg0) {
> super(arg0);
> }
> public void testKey() throws Exception {
> String key = "javax.xml.transform.TransformerFactory";
> String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
> Properties props = System.getProperties();
> props.put(key, value);
> System.setProperties(props);
> TransformerFactory tFactory = TransformerFactory.newInstance();
> String xsl = getClass().getResource("test.xsl").getPath();
> //1 transformation
> Source xml = new StreamSource(new File(getClass()
> .getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
> transformer.transform(xml, new StreamResult(out));
> System.out.println(out.toString());
> //2 transformation
> xml = new StreamSource(new File(getClass().getResource("habP0.xml")
> .getPath()));
> ByteArrayOutputStream out2 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out2));
> System.out.println(out2.toString());
> //3 transformation
> xml = new StreamSource(new File(getClass().getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out3 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out3));
> System.out.println(out3.toString());
> assertEquals(out.toString(),out3.toString());
> }
> }
> --------test.xsl----------------------
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="text" encoding="ISO-8859-1" indent="yes" />
> <xsl:key name="clef_habilitations" match ="action" use = "nom" />
> <xsl:template match="/">
>
> -<xsl:value-of select="key('clef_habilitations','nom1')/nom" />-
> -<xsl:value-of select="key('clef_habilitations','nom2')/nom" />-
> </xsl:template>
> </xsl:stylesheet>
> ---------habP0.xml------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom2</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
> </habilitation>
> ------------habP1.xml--------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
>
> </habilitation>
> ----------System.out---------------------
>
> -nom1-
> --
>
>
>
> -nom1-
> -nom2-
>
>
>
> -nom1-
> -nom3-
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Updated: (XALANJ-2140) Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANJ-2140?page=all ]
Brian Minchau updated XALANJ-2140:
----------------------------------
Xalan info: [PatchAvailable]
> Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
> -------------------------------------------------------------------------------------
>
> Key: XALANJ-2140
> URL: http://issues.apache.org/jira/browse/XALANJ-2140
> Project: XalanJ2
> Type: Bug
> Components: XSLTC
> Versions: 2.6
> Environment: windows jdk 1.4.2_06 xsltc
> Reporter: arn44
> Assignee: Henry Zongaro
> Priority: Critical
> Fix For: 2.7.0-future-release
> Attachments: j2140.patch.txt
>
> Hello,
> I have a problem with a stylesheet containing a xsl:key.
> I have the impression that the Transformer object guard into memory preceding xml source.
> Here a testcase to reproduce the problem.
> The first transformation and the third should produce the same thing.
> It is true with Xalan interpretive.
> It is not the case in xsltc.
> _________________________
> package test;
> import junit.framework.TestCase;
> import java.io.ByteArrayOutputStream;
> import java.io.File;
> import java.util.Properties;
> import javax.xml.transform.Source;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
> public class XSLTTest extends TestCase {
> public XSLTTest(String arg0) {
> super(arg0);
> }
> public void testKey() throws Exception {
> String key = "javax.xml.transform.TransformerFactory";
> String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
> Properties props = System.getProperties();
> props.put(key, value);
> System.setProperties(props);
> TransformerFactory tFactory = TransformerFactory.newInstance();
> String xsl = getClass().getResource("test.xsl").getPath();
> //1 transformation
> Source xml = new StreamSource(new File(getClass()
> .getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
> transformer.transform(xml, new StreamResult(out));
> System.out.println(out.toString());
> //2 transformation
> xml = new StreamSource(new File(getClass().getResource("habP0.xml")
> .getPath()));
> ByteArrayOutputStream out2 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out2));
> System.out.println(out2.toString());
> //3 transformation
> xml = new StreamSource(new File(getClass().getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out3 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out3));
> System.out.println(out3.toString());
> assertEquals(out.toString(),out3.toString());
> }
> }
> --------test.xsl----------------------
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="text" encoding="ISO-8859-1" indent="yes" />
> <xsl:key name="clef_habilitations" match ="action" use = "nom" />
> <xsl:template match="/">
>
> -<xsl:value-of select="key('clef_habilitations','nom1')/nom" />-
> -<xsl:value-of select="key('clef_habilitations','nom2')/nom" />-
> </xsl:template>
> </xsl:stylesheet>
> ---------habP0.xml------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom2</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
> </habilitation>
> ------------habP1.xml--------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
>
> </habilitation>
> ----------System.out---------------------
>
> -nom1-
> --
>
>
>
> -nom1-
> -nom2-
>
>
>
> -nom1-
> -nom3-
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Updated: (XALANJ-2140) Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANJ-2140?page=all ]
Brian Minchau updated XALANJ-2140:
----------------------------------
Fix Version: 2.7
(was: CurrentCVS)
> Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
> -------------------------------------------------------------------------------------
>
> Key: XALANJ-2140
> URL: http://issues.apache.org/jira/browse/XALANJ-2140
> Project: XalanJ2
> Type: Bug
> Components: XSLTC
> Versions: 2.6
> Environment: windows jdk 1.4.2_06 xsltc
> Reporter: arn44
> Assignee: Henry Zongaro
> Priority: Critical
> Fix For: 2.7
> Attachments: j2140.patch.txt
>
> Hello,
> I have a problem with a stylesheet containing a xsl:key.
> I have the impression that the Transformer object guard into memory preceding xml source.
> Here a testcase to reproduce the problem.
> The first transformation and the third should produce the same thing.
> It is true with Xalan interpretive.
> It is not the case in xsltc.
> _________________________
> package test;
> import junit.framework.TestCase;
> import java.io.ByteArrayOutputStream;
> import java.io.File;
> import java.util.Properties;
> import javax.xml.transform.Source;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
> public class XSLTTest extends TestCase {
> public XSLTTest(String arg0) {
> super(arg0);
> }
> public void testKey() throws Exception {
> String key = "javax.xml.transform.TransformerFactory";
> String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
> Properties props = System.getProperties();
> props.put(key, value);
> System.setProperties(props);
> TransformerFactory tFactory = TransformerFactory.newInstance();
> String xsl = getClass().getResource("test.xsl").getPath();
> //1 transformation
> Source xml = new StreamSource(new File(getClass()
> .getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
> transformer.transform(xml, new StreamResult(out));
> System.out.println(out.toString());
> //2 transformation
> xml = new StreamSource(new File(getClass().getResource("habP0.xml")
> .getPath()));
> ByteArrayOutputStream out2 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out2));
> System.out.println(out2.toString());
> //3 transformation
> xml = new StreamSource(new File(getClass().getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out3 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out3));
> System.out.println(out3.toString());
> assertEquals(out.toString(),out3.toString());
> }
> }
> --------test.xsl----------------------
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="text" encoding="ISO-8859-1" indent="yes" />
> <xsl:key name="clef_habilitations" match ="action" use = "nom" />
> <xsl:template match="/">
>
> -<xsl:value-of select="key('clef_habilitations','nom1')/nom" />-
> -<xsl:value-of select="key('clef_habilitations','nom2')/nom" />-
> </xsl:template>
> </xsl:stylesheet>
> ---------habP0.xml------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom2</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
> </habilitation>
> ------------habP1.xml--------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
>
> </habilitation>
> ----------System.out---------------------
>
> -nom1-
> --
>
>
>
> -nom1-
> -nom2-
>
>
>
> -nom1-
> -nom3-
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Resolved: (XALANJ-2140) Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
Posted by "Henry Zongaro (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANJ-2140?page=all ]
Henry Zongaro resolved XALANJ-2140:
-----------------------------------
Fix Version: CurrentCVS
(was: 2.7.0-future-release)
Resolution: Fixed
Applied patch to CVS.
> Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
> -------------------------------------------------------------------------------------
>
> Key: XALANJ-2140
> URL: http://issues.apache.org/jira/browse/XALANJ-2140
> Project: XalanJ2
> Type: Bug
> Components: XSLTC
> Versions: 2.6
> Environment: windows jdk 1.4.2_06 xsltc
> Reporter: arn44
> Assignee: Henry Zongaro
> Priority: Critical
> Fix For: CurrentCVS
> Attachments: j2140.patch.txt
>
> Hello,
> I have a problem with a stylesheet containing a xsl:key.
> I have the impression that the Transformer object guard into memory preceding xml source.
> Here a testcase to reproduce the problem.
> The first transformation and the third should produce the same thing.
> It is true with Xalan interpretive.
> It is not the case in xsltc.
> _________________________
> package test;
> import junit.framework.TestCase;
> import java.io.ByteArrayOutputStream;
> import java.io.File;
> import java.util.Properties;
> import javax.xml.transform.Source;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
> public class XSLTTest extends TestCase {
> public XSLTTest(String arg0) {
> super(arg0);
> }
> public void testKey() throws Exception {
> String key = "javax.xml.transform.TransformerFactory";
> String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
> Properties props = System.getProperties();
> props.put(key, value);
> System.setProperties(props);
> TransformerFactory tFactory = TransformerFactory.newInstance();
> String xsl = getClass().getResource("test.xsl").getPath();
> //1 transformation
> Source xml = new StreamSource(new File(getClass()
> .getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
> transformer.transform(xml, new StreamResult(out));
> System.out.println(out.toString());
> //2 transformation
> xml = new StreamSource(new File(getClass().getResource("habP0.xml")
> .getPath()));
> ByteArrayOutputStream out2 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out2));
> System.out.println(out2.toString());
> //3 transformation
> xml = new StreamSource(new File(getClass().getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out3 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out3));
> System.out.println(out3.toString());
> assertEquals(out.toString(),out3.toString());
> }
> }
> --------test.xsl----------------------
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="text" encoding="ISO-8859-1" indent="yes" />
> <xsl:key name="clef_habilitations" match ="action" use = "nom" />
> <xsl:template match="/">
>
> -<xsl:value-of select="key('clef_habilitations','nom1')/nom" />-
> -<xsl:value-of select="key('clef_habilitations','nom2')/nom" />-
> </xsl:template>
> </xsl:stylesheet>
> ---------habP0.xml------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom2</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
> </habilitation>
> ------------habP1.xml--------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
>
> </habilitation>
> ----------System.out---------------------
>
> -nom1-
> --
>
>
>
> -nom1-
> -nom2-
>
>
>
> -nom1-
> -nom3-
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Updated: (XALANJ-2140) Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANJ-2140?page=all ]
Brian Minchau updated XALANJ-2140:
----------------------------------
reviewer: minchau@ca.ibm.com
Assigning Brian M. as patch reviewer, per JIRA meeting June 7.
> Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
> -------------------------------------------------------------------------------------
>
> Key: XALANJ-2140
> URL: http://issues.apache.org/jira/browse/XALANJ-2140
> Project: XalanJ2
> Type: Bug
> Components: XSLTC
> Versions: 2.6
> Environment: windows jdk 1.4.2_06 xsltc
> Reporter: arn44
> Assignee: Henry Zongaro
> Priority: Critical
> Fix For: 2.7.0-future-release
> Attachments: j2140.patch.txt
>
> Hello,
> I have a problem with a stylesheet containing a xsl:key.
> I have the impression that the Transformer object guard into memory preceding xml source.
> Here a testcase to reproduce the problem.
> The first transformation and the third should produce the same thing.
> It is true with Xalan interpretive.
> It is not the case in xsltc.
> _________________________
> package test;
> import junit.framework.TestCase;
> import java.io.ByteArrayOutputStream;
> import java.io.File;
> import java.util.Properties;
> import javax.xml.transform.Source;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
> public class XSLTTest extends TestCase {
> public XSLTTest(String arg0) {
> super(arg0);
> }
> public void testKey() throws Exception {
> String key = "javax.xml.transform.TransformerFactory";
> String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
> Properties props = System.getProperties();
> props.put(key, value);
> System.setProperties(props);
> TransformerFactory tFactory = TransformerFactory.newInstance();
> String xsl = getClass().getResource("test.xsl").getPath();
> //1 transformation
> Source xml = new StreamSource(new File(getClass()
> .getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
> transformer.transform(xml, new StreamResult(out));
> System.out.println(out.toString());
> //2 transformation
> xml = new StreamSource(new File(getClass().getResource("habP0.xml")
> .getPath()));
> ByteArrayOutputStream out2 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out2));
> System.out.println(out2.toString());
> //3 transformation
> xml = new StreamSource(new File(getClass().getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out3 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out3));
> System.out.println(out3.toString());
> assertEquals(out.toString(),out3.toString());
> }
> }
> --------test.xsl----------------------
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="text" encoding="ISO-8859-1" indent="yes" />
> <xsl:key name="clef_habilitations" match ="action" use = "nom" />
> <xsl:template match="/">
>
> -<xsl:value-of select="key('clef_habilitations','nom1')/nom" />-
> -<xsl:value-of select="key('clef_habilitations','nom2')/nom" />-
> </xsl:template>
> </xsl:stylesheet>
> ---------habP0.xml------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom2</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
> </habilitation>
> ------------habP1.xml--------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
>
> </habilitation>
> ----------System.out---------------------
>
> -nom1-
> --
>
>
>
> -nom1-
> -nom2-
>
>
>
> -nom1-
> -nom3-
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Updated: (XALANJ-2140) Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANJ-2140?page=all ]
Brian Minchau updated XALANJ-2140:
----------------------------------
Fix Version: 2.7.0-future-release
Set Fix version to 2.7.0, as this is a fix we want to get in for 2.7.0 release.
> Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
> -------------------------------------------------------------------------------------
>
> Key: XALANJ-2140
> URL: http://issues.apache.org/jira/browse/XALANJ-2140
> Project: XalanJ2
> Type: Bug
> Components: XSLTC
> Versions: 2.6
> Environment: windows jdk 1.4.2_06 xsltc
> Reporter: arn44
> Assignee: Henry Zongaro
> Priority: Critical
> Fix For: 2.7.0-future-release
> Attachments: j2140.patch.txt
>
> Hello,
> I have a problem with a stylesheet containing a xsl:key.
> I have the impression that the Transformer object guard into memory preceding xml source.
> Here a testcase to reproduce the problem.
> The first transformation and the third should produce the same thing.
> It is true with Xalan interpretive.
> It is not the case in xsltc.
> _________________________
> package test;
> import junit.framework.TestCase;
> import java.io.ByteArrayOutputStream;
> import java.io.File;
> import java.util.Properties;
> import javax.xml.transform.Source;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
> public class XSLTTest extends TestCase {
> public XSLTTest(String arg0) {
> super(arg0);
> }
> public void testKey() throws Exception {
> String key = "javax.xml.transform.TransformerFactory";
> String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
> Properties props = System.getProperties();
> props.put(key, value);
> System.setProperties(props);
> TransformerFactory tFactory = TransformerFactory.newInstance();
> String xsl = getClass().getResource("test.xsl").getPath();
> //1 transformation
> Source xml = new StreamSource(new File(getClass()
> .getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
> transformer.transform(xml, new StreamResult(out));
> System.out.println(out.toString());
> //2 transformation
> xml = new StreamSource(new File(getClass().getResource("habP0.xml")
> .getPath()));
> ByteArrayOutputStream out2 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out2));
> System.out.println(out2.toString());
> //3 transformation
> xml = new StreamSource(new File(getClass().getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out3 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out3));
> System.out.println(out3.toString());
> assertEquals(out.toString(),out3.toString());
> }
> }
> --------test.xsl----------------------
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="text" encoding="ISO-8859-1" indent="yes" />
> <xsl:key name="clef_habilitations" match ="action" use = "nom" />
> <xsl:template match="/">
>
> -<xsl:value-of select="key('clef_habilitations','nom1')/nom" />-
> -<xsl:value-of select="key('clef_habilitations','nom2')/nom" />-
> </xsl:template>
> </xsl:stylesheet>
> ---------habP0.xml------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom2</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
> </habilitation>
> ------------habP1.xml--------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
>
> </habilitation>
> ----------System.out---------------------
>
> -nom1-
> --
>
>
>
> -nom1-
> -nom2-
>
>
>
> -nom1-
> -nom3-
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Commented: (XALANJ-2140) Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
Posted by "Henry Zongaro (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANJ-2140?page=comments#action_12312785 ]
Henry Zongaro commented on XALANJ-2140:
---------------------------------------
It looks like information built for xsl:key from one transformation is contaminating subsequent transformations. I've attached a patch [1] that will clear any xsl:key information gathered at the end of a transformation.
[1] http://issues.apache.org/jira/secure/attachment/12310557/j2140.patch.txt
> Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
> -------------------------------------------------------------------------------------
>
> Key: XALANJ-2140
> URL: http://issues.apache.org/jira/browse/XALANJ-2140
> Project: XalanJ2
> Type: Bug
> Components: XSLTC
> Versions: 2.6
> Environment: windows jdk 1.4.2_06 xsltc
> Reporter: arn44
> Priority: Critical
> Attachments: j2140.patch.txt
>
> Hello,
> I have a problem with a stylesheet containing a xsl:key.
> I have the impression that the Transformer object guard into memory preceding xml source.
> Here a testcase to reproduce the problem.
> The first transformation and the third should produce the same thing.
> It is true with Xalan interpretive.
> It is not the case in xsltc.
> _________________________
> package test;
> import junit.framework.TestCase;
> import java.io.ByteArrayOutputStream;
> import java.io.File;
> import java.util.Properties;
> import javax.xml.transform.Source;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
> public class XSLTTest extends TestCase {
> public XSLTTest(String arg0) {
> super(arg0);
> }
> public void testKey() throws Exception {
> String key = "javax.xml.transform.TransformerFactory";
> String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
> Properties props = System.getProperties();
> props.put(key, value);
> System.setProperties(props);
> TransformerFactory tFactory = TransformerFactory.newInstance();
> String xsl = getClass().getResource("test.xsl").getPath();
> //1 transformation
> Source xml = new StreamSource(new File(getClass()
> .getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
> transformer.transform(xml, new StreamResult(out));
> System.out.println(out.toString());
> //2 transformation
> xml = new StreamSource(new File(getClass().getResource("habP0.xml")
> .getPath()));
> ByteArrayOutputStream out2 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out2));
> System.out.println(out2.toString());
> //3 transformation
> xml = new StreamSource(new File(getClass().getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out3 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out3));
> System.out.println(out3.toString());
> assertEquals(out.toString(),out3.toString());
> }
> }
> --------test.xsl----------------------
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="text" encoding="ISO-8859-1" indent="yes" />
> <xsl:key name="clef_habilitations" match ="action" use = "nom" />
> <xsl:template match="/">
>
> -<xsl:value-of select="key('clef_habilitations','nom1')/nom" />-
> -<xsl:value-of select="key('clef_habilitations','nom2')/nom" />-
> </xsl:template>
> </xsl:stylesheet>
> ---------habP0.xml------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom2</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
> </habilitation>
> ------------habP1.xml--------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
>
> </habilitation>
> ----------System.out---------------------
>
> -nom1-
> --
>
>
>
> -nom1-
> -nom2-
>
>
>
> -nom1-
> -nom3-
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Assigned: (XALANJ-2140) Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANJ-2140?page=all ]
Brian Minchau reassigned XALANJ-2140:
-------------------------------------
Assign To: Henry Zongaro
Assigning to Henry Z., per JIRA meeting June 7.
> Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
> -------------------------------------------------------------------------------------
>
> Key: XALANJ-2140
> URL: http://issues.apache.org/jira/browse/XALANJ-2140
> Project: XalanJ2
> Type: Bug
> Components: XSLTC
> Versions: 2.6
> Environment: windows jdk 1.4.2_06 xsltc
> Reporter: arn44
> Assignee: Henry Zongaro
> Priority: Critical
> Fix For: 2.7.0-future-release
> Attachments: j2140.patch.txt
>
> Hello,
> I have a problem with a stylesheet containing a xsl:key.
> I have the impression that the Transformer object guard into memory preceding xml source.
> Here a testcase to reproduce the problem.
> The first transformation and the third should produce the same thing.
> It is true with Xalan interpretive.
> It is not the case in xsltc.
> _________________________
> package test;
> import junit.framework.TestCase;
> import java.io.ByteArrayOutputStream;
> import java.io.File;
> import java.util.Properties;
> import javax.xml.transform.Source;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
> public class XSLTTest extends TestCase {
> public XSLTTest(String arg0) {
> super(arg0);
> }
> public void testKey() throws Exception {
> String key = "javax.xml.transform.TransformerFactory";
> String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
> Properties props = System.getProperties();
> props.put(key, value);
> System.setProperties(props);
> TransformerFactory tFactory = TransformerFactory.newInstance();
> String xsl = getClass().getResource("test.xsl").getPath();
> //1 transformation
> Source xml = new StreamSource(new File(getClass()
> .getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
> transformer.transform(xml, new StreamResult(out));
> System.out.println(out.toString());
> //2 transformation
> xml = new StreamSource(new File(getClass().getResource("habP0.xml")
> .getPath()));
> ByteArrayOutputStream out2 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out2));
> System.out.println(out2.toString());
> //3 transformation
> xml = new StreamSource(new File(getClass().getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out3 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out3));
> System.out.println(out3.toString());
> assertEquals(out.toString(),out3.toString());
> }
> }
> --------test.xsl----------------------
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="text" encoding="ISO-8859-1" indent="yes" />
> <xsl:key name="clef_habilitations" match ="action" use = "nom" />
> <xsl:template match="/">
>
> -<xsl:value-of select="key('clef_habilitations','nom1')/nom" />-
> -<xsl:value-of select="key('clef_habilitations','nom2')/nom" />-
> </xsl:template>
> </xsl:stylesheet>
> ---------habP0.xml------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom2</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
> </habilitation>
> ------------habP1.xml--------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
>
> </habilitation>
> ----------System.out---------------------
>
> -nom1-
> --
>
>
>
> -nom1-
> -nom2-
>
>
>
> -nom1-
> -nom3-
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Commented: (XALANJ-2140) Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANJ-2140?page=comments#action_12315409 ]
Brian Minchau commented on XALANJ-2140:
---------------------------------------
I have reviewed, and approve the patch. Looks good to me.
> Re-use the same transformer with stylesheet containing xsl:key doesn't work correctly
> -------------------------------------------------------------------------------------
>
> Key: XALANJ-2140
> URL: http://issues.apache.org/jira/browse/XALANJ-2140
> Project: XalanJ2
> Type: Bug
> Components: XSLTC
> Versions: 2.6
> Environment: windows jdk 1.4.2_06 xsltc
> Reporter: arn44
> Assignee: Henry Zongaro
> Priority: Critical
> Fix For: 2.7.0-future-release
> Attachments: j2140.patch.txt
>
> Hello,
> I have a problem with a stylesheet containing a xsl:key.
> I have the impression that the Transformer object guard into memory preceding xml source.
> Here a testcase to reproduce the problem.
> The first transformation and the third should produce the same thing.
> It is true with Xalan interpretive.
> It is not the case in xsltc.
> _________________________
> package test;
> import junit.framework.TestCase;
> import java.io.ByteArrayOutputStream;
> import java.io.File;
> import java.util.Properties;
> import javax.xml.transform.Source;
> import javax.xml.transform.Transformer;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.stream.StreamResult;
> import javax.xml.transform.stream.StreamSource;
> public class XSLTTest extends TestCase {
> public XSLTTest(String arg0) {
> super(arg0);
> }
> public void testKey() throws Exception {
> String key = "javax.xml.transform.TransformerFactory";
> String value = "org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
> Properties props = System.getProperties();
> props.put(key, value);
> System.setProperties(props);
> TransformerFactory tFactory = TransformerFactory.newInstance();
> String xsl = getClass().getResource("test.xsl").getPath();
> //1 transformation
> Source xml = new StreamSource(new File(getClass()
> .getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> Transformer transformer = tFactory.newTransformer(new StreamSource(xsl));
> transformer.transform(xml, new StreamResult(out));
> System.out.println(out.toString());
> //2 transformation
> xml = new StreamSource(new File(getClass().getResource("habP0.xml")
> .getPath()));
> ByteArrayOutputStream out2 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out2));
> System.out.println(out2.toString());
> //3 transformation
> xml = new StreamSource(new File(getClass().getResource("habP1.xml")
> .getPath()));
> ByteArrayOutputStream out3 = new ByteArrayOutputStream();
> transformer.transform(xml, new StreamResult(out3));
> System.out.println(out3.toString());
> assertEquals(out.toString(),out3.toString());
> }
> }
> --------test.xsl----------------------
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="text" encoding="ISO-8859-1" indent="yes" />
> <xsl:key name="clef_habilitations" match ="action" use = "nom" />
> <xsl:template match="/">
>
> -<xsl:value-of select="key('clef_habilitations','nom1')/nom" />-
> -<xsl:value-of select="key('clef_habilitations','nom2')/nom" />-
> </xsl:template>
> </xsl:stylesheet>
> ---------habP0.xml------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom2</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
> </habilitation>
> ------------habP1.xml--------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <habilitation>
> <action>
> <nom>nom1</nom>
> </action>
> <action>
> <nom>nom3</nom>
> </action>
> <action>
> <nom>nom4</nom>
> </action>
>
>
> </habilitation>
> ----------System.out---------------------
>
> -nom1-
> --
>
>
>
> -nom1-
> -nom2-
>
>
>
> -nom1-
> -nom3-
>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org