You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Stewart Witchalls (JIRA)" <ji...@apache.org> on 2007/10/08 09:52:37 UTC

[jira] Created: (WW-2234) XSLTResut.exposedValue transform failing on CDATA elements

XSLTResut.exposedValue transform failing on CDATA elements
----------------------------------------------------------

                 Key: WW-2234
                 URL: https://issues.apache.org/struts/browse/WW-2234
             Project: Struts 2
          Issue Type: Bug
    Affects Versions: 2.0.9
         Environment: Tomcat 6.0.14
Struts 2.0.9
JDK 1.5.0_11
Xalan 2.7.0
            Reporter: Stewart Witchalls
            Priority: Minor


Xalan 2.7.0 (with bundled Xerces) installed into $JDK_HOME/jre/lib/endorsed and $TOMCAT_HOME/common/endorsed

action config:
        <action name="ShowDataFormDemo" class="ShowDataFormDemo">
            <result type="xslt">
            	<param name="location">/WEB-INF/xsl/CreateDataForm.xsl</param>
            	<param name="exposedValue">presenterXml</param>
            </result>
        </action>

ShowDataFormDemo.presenterXml code:
  public org.w3c.dom.Document getPresenterXml() throws Exception
  {
	final byte[] data = this.presenterXml.getBytes("UTF-8");
    	final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        final Document doc2 = factory.newDocumentBuilder().parse( new ByteArrayInputStream(data) );

        // debug to see if XPATH works inside server
	final XPathFactory fact = XPathFactory.newInstance();
	final XPath xpath = fact.newXPath();
	final XPathExpression xexpr = xpath.compile( "count(//items/*)" );
	System.out.println( xexpr.evaluate( doc2.getDocumentElement(), XPathConstants.NUMBER ) );

	return doc2;
  }

XML:
<data>
<items>
<heading inline="true">
<text><![CDATA[Data form example]]></text></heading>
<paragraph inline="true">
<text><![CDATA[Some explanatory text.]]></text></paragraph>
<subHeading inline="true">
<text><![CDATA[Lists]]></text></subHeading>
</items>
</data>

CreateDataForm.xsl fragment:
    vendor = <xsl:value-of select="system-property('xsl:vendor')"/>
    vendor-url = <xsl:value-of select="system-property('xsl:vendor-url')"/>
    xslt-version = <xsl:value-of select="system-property('xsl:version')"/>
    count(items) = <xsl:value-of select="count(//items/*)"/>


XPath in code works and returns correct count (aka. 3).

However, same xpath in CreateDataForm.xsl transform fails and only returns 1. Also, transform not able to obtain CDATA values (ie. displays nothing when "text" element selected).

I've removed + added rows to the XML. The CreateDataForm.xsl transform always says count = "1". It looks like it cannot see past the first CDATA section.

If I remove the CDATA sections (ie. encode the element data as XML encoded strings), transform xpath works??!!

I've checked classpaths and can confirm that the endorsed Xalan libraries are being picked up.

I've even run the transform inside the action itself. It worked as expected.

I can work around this by removing the CDATA sections from the XML, but I've spent the last few days going mad. Just cannot see what's going wrong.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2234) XSLTResut.exposedValue transform failing on CDATA elements

Posted by "Stewart Witchalls (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44454#action_44454 ] 

Stewart Witchalls commented on WW-2234:
---------------------------------------

re: Don (14/07) - Code is in this report's description section (see getPresenterXml() code fragment). The XPATH expression "count(//items/*)" works when executed inside the getPresenterXml() method, but fails when run inside the transform (see CreateDataForm.xsl fragment).

re: Musachy (21/07). No errors that I can see. The "CDATA" blocks are in the XML being transformed (see  "XML:" in report description).

re: Dave (21/07). What misunderstanding? Can you expand? The transform works fine when CDATA blocks are removed so I am confused as to why I am using XSLTResult incorrectly??!!


> XSLTResut.exposedValue transform failing on CDATA elements
> ----------------------------------------------------------
>
>                 Key: WW-2234
>                 URL: https://issues.apache.org/struts/browse/WW-2234
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: Tomcat 6.0.14
> Struts 2.0.9
> JDK 1.5.0_11
> Xalan 2.7.0
>            Reporter: Stewart Witchalls
>            Priority: Minor
>             Fix For: 2.1.3
>
>
> Xalan 2.7.0 (with bundled Xerces) installed into $JDK_HOME/jre/lib/endorsed and $TOMCAT_HOME/common/endorsed
> action config:
>         <action name="ShowDataFormDemo" class="ShowDataFormDemo">
>             <result type="xslt">
>             	<param name="location">/WEB-INF/xsl/CreateDataForm.xsl</param>
>             	<param name="exposedValue">presenterXml</param>
>             </result>
>         </action>
> ShowDataFormDemo.presenterXml code:
>   public org.w3c.dom.Document getPresenterXml() throws Exception
>   {
> 	final byte[] data = this.presenterXml.getBytes("UTF-8");
>     	final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>         final Document doc2 = factory.newDocumentBuilder().parse( new ByteArrayInputStream(data) );
>         // debug to see if XPATH works inside server
> 	final XPathFactory fact = XPathFactory.newInstance();
> 	final XPath xpath = fact.newXPath();
> 	final XPathExpression xexpr = xpath.compile( "count(//items/*)" );
> 	System.out.println( xexpr.evaluate( doc2.getDocumentElement(), XPathConstants.NUMBER ) );
> 	return doc2;
>   }
> XML:
> <data>
> <items>
> <heading inline="true">
> <text><![CDATA[Data form example]]></text></heading>
> <paragraph inline="true">
> <text><![CDATA[Some explanatory text.]]></text></paragraph>
> <subHeading inline="true">
> <text><![CDATA[Lists]]></text></subHeading>
> </items>
> </data>
> CreateDataForm.xsl fragment:
>     vendor = <xsl:value-of select="system-property('xsl:vendor')"/>
>     vendor-url = <xsl:value-of select="system-property('xsl:vendor-url')"/>
>     xslt-version = <xsl:value-of select="system-property('xsl:version')"/>
>     count(items) = <xsl:value-of select="count(//items/*)"/>
> XPath in code works and returns correct count (aka. 3).
> However, same xpath in CreateDataForm.xsl transform fails and only returns 1. Also, transform not able to obtain CDATA values (ie. displays nothing when "text" element selected).
> I've removed + added rows to the XML. The CreateDataForm.xsl transform always says count = "1". It looks like it cannot see past the first CDATA section.
> If I remove the CDATA sections (ie. encode the element data as XML encoded strings), transform xpath works??!!
> I've checked classpaths and can confirm that the endorsed Xalan libraries are being picked up.
> I've even run the transform inside the action itself. It worked as expected.
> I can work around this by removing the CDATA sections from the XML, but I've spent the last few days going mad. Just cannot see what's going wrong.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2234) XSLTResut.exposedValue transform failing on CDATA elements

Posted by "Stewart Witchalls (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44171#action_44171 ] 

Stewart Witchalls commented on WW-2234:
---------------------------------------

Hi James,

No I haven't found a solution yet. I'm using struts2 version 2.0.9.

XPath works when no CDATA and fails when CDATA present. Therefore, I'm assuming the problem is not my code.

> XSLTResut.exposedValue transform failing on CDATA elements
> ----------------------------------------------------------
>
>                 Key: WW-2234
>                 URL: https://issues.apache.org/struts/browse/WW-2234
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: Tomcat 6.0.14
> Struts 2.0.9
> JDK 1.5.0_11
> Xalan 2.7.0
>            Reporter: Stewart Witchalls
>            Priority: Minor
>             Fix For: 2.1.3
>
>
> Xalan 2.7.0 (with bundled Xerces) installed into $JDK_HOME/jre/lib/endorsed and $TOMCAT_HOME/common/endorsed
> action config:
>         <action name="ShowDataFormDemo" class="ShowDataFormDemo">
>             <result type="xslt">
>             	<param name="location">/WEB-INF/xsl/CreateDataForm.xsl</param>
>             	<param name="exposedValue">presenterXml</param>
>             </result>
>         </action>
> ShowDataFormDemo.presenterXml code:
>   public org.w3c.dom.Document getPresenterXml() throws Exception
>   {
> 	final byte[] data = this.presenterXml.getBytes("UTF-8");
>     	final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>         final Document doc2 = factory.newDocumentBuilder().parse( new ByteArrayInputStream(data) );
>         // debug to see if XPATH works inside server
> 	final XPathFactory fact = XPathFactory.newInstance();
> 	final XPath xpath = fact.newXPath();
> 	final XPathExpression xexpr = xpath.compile( "count(//items/*)" );
> 	System.out.println( xexpr.evaluate( doc2.getDocumentElement(), XPathConstants.NUMBER ) );
> 	return doc2;
>   }
> XML:
> <data>
> <items>
> <heading inline="true">
> <text><![CDATA[Data form example]]></text></heading>
> <paragraph inline="true">
> <text><![CDATA[Some explanatory text.]]></text></paragraph>
> <subHeading inline="true">
> <text><![CDATA[Lists]]></text></subHeading>
> </items>
> </data>
> CreateDataForm.xsl fragment:
>     vendor = <xsl:value-of select="system-property('xsl:vendor')"/>
>     vendor-url = <xsl:value-of select="system-property('xsl:vendor-url')"/>
>     xslt-version = <xsl:value-of select="system-property('xsl:version')"/>
>     count(items) = <xsl:value-of select="count(//items/*)"/>
> XPath in code works and returns correct count (aka. 3).
> However, same xpath in CreateDataForm.xsl transform fails and only returns 1. Also, transform not able to obtain CDATA values (ie. displays nothing when "text" element selected).
> I've removed + added rows to the XML. The CreateDataForm.xsl transform always says count = "1". It looks like it cannot see past the first CDATA section.
> If I remove the CDATA sections (ie. encode the element data as XML encoded strings), transform xpath works??!!
> I've checked classpaths and can confirm that the endorsed Xalan libraries are being picked up.
> I've even run the transform inside the action itself. It worked as expected.
> I can work around this by removing the CDATA sections from the XML, but I've spent the last few days going mad. Just cannot see what's going wrong.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2234) XSLTResut.exposedValue transform failing on CDATA elements

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44130#action_44130 ] 

James Holmes commented on WW-2234:
----------------------------------

Did you ever find out a solution to this problem? Is there an issue with the Struts 2 plugin or something in your code, etc.?

> XSLTResut.exposedValue transform failing on CDATA elements
> ----------------------------------------------------------
>
>                 Key: WW-2234
>                 URL: https://issues.apache.org/struts/browse/WW-2234
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: Tomcat 6.0.14
> Struts 2.0.9
> JDK 1.5.0_11
> Xalan 2.7.0
>            Reporter: Stewart Witchalls
>            Priority: Minor
>             Fix For: 2.1.3
>
>
> Xalan 2.7.0 (with bundled Xerces) installed into $JDK_HOME/jre/lib/endorsed and $TOMCAT_HOME/common/endorsed
> action config:
>         <action name="ShowDataFormDemo" class="ShowDataFormDemo">
>             <result type="xslt">
>             	<param name="location">/WEB-INF/xsl/CreateDataForm.xsl</param>
>             	<param name="exposedValue">presenterXml</param>
>             </result>
>         </action>
> ShowDataFormDemo.presenterXml code:
>   public org.w3c.dom.Document getPresenterXml() throws Exception
>   {
> 	final byte[] data = this.presenterXml.getBytes("UTF-8");
>     	final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>         final Document doc2 = factory.newDocumentBuilder().parse( new ByteArrayInputStream(data) );
>         // debug to see if XPATH works inside server
> 	final XPathFactory fact = XPathFactory.newInstance();
> 	final XPath xpath = fact.newXPath();
> 	final XPathExpression xexpr = xpath.compile( "count(//items/*)" );
> 	System.out.println( xexpr.evaluate( doc2.getDocumentElement(), XPathConstants.NUMBER ) );
> 	return doc2;
>   }
> XML:
> <data>
> <items>
> <heading inline="true">
> <text><![CDATA[Data form example]]></text></heading>
> <paragraph inline="true">
> <text><![CDATA[Some explanatory text.]]></text></paragraph>
> <subHeading inline="true">
> <text><![CDATA[Lists]]></text></subHeading>
> </items>
> </data>
> CreateDataForm.xsl fragment:
>     vendor = <xsl:value-of select="system-property('xsl:vendor')"/>
>     vendor-url = <xsl:value-of select="system-property('xsl:vendor-url')"/>
>     xslt-version = <xsl:value-of select="system-property('xsl:version')"/>
>     count(items) = <xsl:value-of select="count(//items/*)"/>
> XPath in code works and returns correct count (aka. 3).
> However, same xpath in CreateDataForm.xsl transform fails and only returns 1. Also, transform not able to obtain CDATA values (ie. displays nothing when "text" element selected).
> I've removed + added rows to the XML. The CreateDataForm.xsl transform always says count = "1". It looks like it cannot see past the first CDATA section.
> If I remove the CDATA sections (ie. encode the element data as XML encoded strings), transform xpath works??!!
> I've checked classpaths and can confirm that the endorsed Xalan libraries are being picked up.
> I've even run the transform inside the action itself. It worked as expected.
> I can work around this by removing the CDATA sections from the XML, but I've spent the last few days going mad. Just cannot see what's going wrong.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2234) XSLTResut.exposedValue transform failing on CDATA elements

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2234?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown updated WW-2234:
--------------------------

    Fix Version/s:     (was: 2.1.4)
                   2.1.3

> XSLTResut.exposedValue transform failing on CDATA elements
> ----------------------------------------------------------
>
>                 Key: WW-2234
>                 URL: https://issues.apache.org/struts/browse/WW-2234
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: Tomcat 6.0.14
> Struts 2.0.9
> JDK 1.5.0_11
> Xalan 2.7.0
>            Reporter: Stewart Witchalls
>            Priority: Minor
>             Fix For: 2.1.3
>
>
> Xalan 2.7.0 (with bundled Xerces) installed into $JDK_HOME/jre/lib/endorsed and $TOMCAT_HOME/common/endorsed
> action config:
>         <action name="ShowDataFormDemo" class="ShowDataFormDemo">
>             <result type="xslt">
>             	<param name="location">/WEB-INF/xsl/CreateDataForm.xsl</param>
>             	<param name="exposedValue">presenterXml</param>
>             </result>
>         </action>
> ShowDataFormDemo.presenterXml code:
>   public org.w3c.dom.Document getPresenterXml() throws Exception
>   {
> 	final byte[] data = this.presenterXml.getBytes("UTF-8");
>     	final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>         final Document doc2 = factory.newDocumentBuilder().parse( new ByteArrayInputStream(data) );
>         // debug to see if XPATH works inside server
> 	final XPathFactory fact = XPathFactory.newInstance();
> 	final XPath xpath = fact.newXPath();
> 	final XPathExpression xexpr = xpath.compile( "count(//items/*)" );
> 	System.out.println( xexpr.evaluate( doc2.getDocumentElement(), XPathConstants.NUMBER ) );
> 	return doc2;
>   }
> XML:
> <data>
> <items>
> <heading inline="true">
> <text><![CDATA[Data form example]]></text></heading>
> <paragraph inline="true">
> <text><![CDATA[Some explanatory text.]]></text></paragraph>
> <subHeading inline="true">
> <text><![CDATA[Lists]]></text></subHeading>
> </items>
> </data>
> CreateDataForm.xsl fragment:
>     vendor = <xsl:value-of select="system-property('xsl:vendor')"/>
>     vendor-url = <xsl:value-of select="system-property('xsl:vendor-url')"/>
>     xslt-version = <xsl:value-of select="system-property('xsl:version')"/>
>     count(items) = <xsl:value-of select="count(//items/*)"/>
> XPath in code works and returns correct count (aka. 3).
> However, same xpath in CreateDataForm.xsl transform fails and only returns 1. Also, transform not able to obtain CDATA values (ie. displays nothing when "text" element selected).
> I've removed + added rows to the XML. The CreateDataForm.xsl transform always says count = "1". It looks like it cannot see past the first CDATA section.
> If I remove the CDATA sections (ie. encode the element data as XML encoded strings), transform xpath works??!!
> I've checked classpaths and can confirm that the endorsed Xalan libraries are being picked up.
> I've even run the transform inside the action itself. It worked as expected.
> I can work around this by removing the CDATA sections from the XML, but I've spent the last few days going mad. Just cannot see what's going wrong.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2234) XSLTResut.exposedValue transform failing on CDATA elements

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44460#action_44460 ] 

Dave Newton commented on WW-2234:
---------------------------------

Oh, I had no idea. Please open a JIRA for updated documentation as well.

> XSLTResut.exposedValue transform failing on CDATA elements
> ----------------------------------------------------------
>
>                 Key: WW-2234
>                 URL: https://issues.apache.org/struts/browse/WW-2234
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: Tomcat 6.0.14
> Struts 2.0.9
> JDK 1.5.0_11
> Xalan 2.7.0
>            Reporter: Stewart Witchalls
>            Priority: Minor
>             Fix For: 2.1.3
>
>
> Xalan 2.7.0 (with bundled Xerces) installed into $JDK_HOME/jre/lib/endorsed and $TOMCAT_HOME/common/endorsed
> action config:
>         <action name="ShowDataFormDemo" class="ShowDataFormDemo">
>             <result type="xslt">
>             	<param name="location">/WEB-INF/xsl/CreateDataForm.xsl</param>
>             	<param name="exposedValue">presenterXml</param>
>             </result>
>         </action>
> ShowDataFormDemo.presenterXml code:
>   public org.w3c.dom.Document getPresenterXml() throws Exception
>   {
> 	final byte[] data = this.presenterXml.getBytes("UTF-8");
>     	final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>         final Document doc2 = factory.newDocumentBuilder().parse( new ByteArrayInputStream(data) );
>         // debug to see if XPATH works inside server
> 	final XPathFactory fact = XPathFactory.newInstance();
> 	final XPath xpath = fact.newXPath();
> 	final XPathExpression xexpr = xpath.compile( "count(//items/*)" );
> 	System.out.println( xexpr.evaluate( doc2.getDocumentElement(), XPathConstants.NUMBER ) );
> 	return doc2;
>   }
> XML:
> <data>
> <items>
> <heading inline="true">
> <text><![CDATA[Data form example]]></text></heading>
> <paragraph inline="true">
> <text><![CDATA[Some explanatory text.]]></text></paragraph>
> <subHeading inline="true">
> <text><![CDATA[Lists]]></text></subHeading>
> </items>
> </data>
> CreateDataForm.xsl fragment:
>     vendor = <xsl:value-of select="system-property('xsl:vendor')"/>
>     vendor-url = <xsl:value-of select="system-property('xsl:vendor-url')"/>
>     xslt-version = <xsl:value-of select="system-property('xsl:version')"/>
>     count(items) = <xsl:value-of select="count(//items/*)"/>
> XPath in code works and returns correct count (aka. 3).
> However, same xpath in CreateDataForm.xsl transform fails and only returns 1. Also, transform not able to obtain CDATA values (ie. displays nothing when "text" element selected).
> I've removed + added rows to the XML. The CreateDataForm.xsl transform always says count = "1". It looks like it cannot see past the first CDATA section.
> If I remove the CDATA sections (ie. encode the element data as XML encoded strings), transform xpath works??!!
> I've checked classpaths and can confirm that the endorsed Xalan libraries are being picked up.
> I've even run the transform inside the action itself. It worked as expected.
> I can work around this by removing the CDATA sections from the XML, but I've spent the last few days going mad. Just cannot see what's going wrong.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2234) XSLTResut.exposedValue transform failing on CDATA elements

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44441#action_44441 ] 

Musachy Barroso commented on WW-2234:
-------------------------------------

Any meaningful warn/error in the logs? The XSLT doesn't do much more than creating a transformer and calling "transform". Could you post a simple xslt and that replicates the problem?

> XSLTResut.exposedValue transform failing on CDATA elements
> ----------------------------------------------------------
>
>                 Key: WW-2234
>                 URL: https://issues.apache.org/struts/browse/WW-2234
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: Tomcat 6.0.14
> Struts 2.0.9
> JDK 1.5.0_11
> Xalan 2.7.0
>            Reporter: Stewart Witchalls
>            Priority: Minor
>             Fix For: 2.1.3
>
>
> Xalan 2.7.0 (with bundled Xerces) installed into $JDK_HOME/jre/lib/endorsed and $TOMCAT_HOME/common/endorsed
> action config:
>         <action name="ShowDataFormDemo" class="ShowDataFormDemo">
>             <result type="xslt">
>             	<param name="location">/WEB-INF/xsl/CreateDataForm.xsl</param>
>             	<param name="exposedValue">presenterXml</param>
>             </result>
>         </action>
> ShowDataFormDemo.presenterXml code:
>   public org.w3c.dom.Document getPresenterXml() throws Exception
>   {
> 	final byte[] data = this.presenterXml.getBytes("UTF-8");
>     	final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>         final Document doc2 = factory.newDocumentBuilder().parse( new ByteArrayInputStream(data) );
>         // debug to see if XPATH works inside server
> 	final XPathFactory fact = XPathFactory.newInstance();
> 	final XPath xpath = fact.newXPath();
> 	final XPathExpression xexpr = xpath.compile( "count(//items/*)" );
> 	System.out.println( xexpr.evaluate( doc2.getDocumentElement(), XPathConstants.NUMBER ) );
> 	return doc2;
>   }
> XML:
> <data>
> <items>
> <heading inline="true">
> <text><![CDATA[Data form example]]></text></heading>
> <paragraph inline="true">
> <text><![CDATA[Some explanatory text.]]></text></paragraph>
> <subHeading inline="true">
> <text><![CDATA[Lists]]></text></subHeading>
> </items>
> </data>
> CreateDataForm.xsl fragment:
>     vendor = <xsl:value-of select="system-property('xsl:vendor')"/>
>     vendor-url = <xsl:value-of select="system-property('xsl:vendor-url')"/>
>     xslt-version = <xsl:value-of select="system-property('xsl:version')"/>
>     count(items) = <xsl:value-of select="count(//items/*)"/>
> XPath in code works and returns correct count (aka. 3).
> However, same xpath in CreateDataForm.xsl transform fails and only returns 1. Also, transform not able to obtain CDATA values (ie. displays nothing when "text" element selected).
> I've removed + added rows to the XML. The CreateDataForm.xsl transform always says count = "1". It looks like it cannot see past the first CDATA section.
> If I remove the CDATA sections (ie. encode the element data as XML encoded strings), transform xpath works??!!
> I've checked classpaths and can confirm that the endorsed Xalan libraries are being picked up.
> I've even run the transform inside the action itself. It worked as expected.
> I can work around this by removing the CDATA sections from the XML, but I've spent the last few days going mad. Just cannot see what's going wrong.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2234) XSLTResut.exposedValue transform failing on CDATA elements

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44443#action_44443 ] 

Musachy Barroso commented on WW-2234:
-------------------------------------

trying to reproduce this, now I am confused. "When I remove the CDATA section", where is it that you have these sections? The XSLT result takes as an input objects, not xml. (or I am missign something...)

> XSLTResut.exposedValue transform failing on CDATA elements
> ----------------------------------------------------------
>
>                 Key: WW-2234
>                 URL: https://issues.apache.org/struts/browse/WW-2234
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: Tomcat 6.0.14
> Struts 2.0.9
> JDK 1.5.0_11
> Xalan 2.7.0
>            Reporter: Stewart Witchalls
>            Priority: Minor
>             Fix For: 2.1.3
>
>
> Xalan 2.7.0 (with bundled Xerces) installed into $JDK_HOME/jre/lib/endorsed and $TOMCAT_HOME/common/endorsed
> action config:
>         <action name="ShowDataFormDemo" class="ShowDataFormDemo">
>             <result type="xslt">
>             	<param name="location">/WEB-INF/xsl/CreateDataForm.xsl</param>
>             	<param name="exposedValue">presenterXml</param>
>             </result>
>         </action>
> ShowDataFormDemo.presenterXml code:
>   public org.w3c.dom.Document getPresenterXml() throws Exception
>   {
> 	final byte[] data = this.presenterXml.getBytes("UTF-8");
>     	final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>         final Document doc2 = factory.newDocumentBuilder().parse( new ByteArrayInputStream(data) );
>         // debug to see if XPATH works inside server
> 	final XPathFactory fact = XPathFactory.newInstance();
> 	final XPath xpath = fact.newXPath();
> 	final XPathExpression xexpr = xpath.compile( "count(//items/*)" );
> 	System.out.println( xexpr.evaluate( doc2.getDocumentElement(), XPathConstants.NUMBER ) );
> 	return doc2;
>   }
> XML:
> <data>
> <items>
> <heading inline="true">
> <text><![CDATA[Data form example]]></text></heading>
> <paragraph inline="true">
> <text><![CDATA[Some explanatory text.]]></text></paragraph>
> <subHeading inline="true">
> <text><![CDATA[Lists]]></text></subHeading>
> </items>
> </data>
> CreateDataForm.xsl fragment:
>     vendor = <xsl:value-of select="system-property('xsl:vendor')"/>
>     vendor-url = <xsl:value-of select="system-property('xsl:vendor-url')"/>
>     xslt-version = <xsl:value-of select="system-property('xsl:version')"/>
>     count(items) = <xsl:value-of select="count(//items/*)"/>
> XPath in code works and returns correct count (aka. 3).
> However, same xpath in CreateDataForm.xsl transform fails and only returns 1. Also, transform not able to obtain CDATA values (ie. displays nothing when "text" element selected).
> I've removed + added rows to the XML. The CreateDataForm.xsl transform always says count = "1". It looks like it cannot see past the first CDATA section.
> If I remove the CDATA sections (ie. encode the element data as XML encoded strings), transform xpath works??!!
> I've checked classpaths and can confirm that the endorsed Xalan libraries are being picked up.
> I've even run the transform inside the action itself. It worked as expected.
> I can work around this by removing the CDATA sections from the XML, but I've spent the last few days going mad. Just cannot see what's going wrong.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2234) XSLTResut.exposedValue transform failing on CDATA elements

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44371#action_44371 ] 

Don Brown commented on WW-2234:
-------------------------------

Could you post the code where you run the xslt transformation in your action and it works?  I'd like to see what you are doing different than to how the XSLTResult does it.

> XSLTResut.exposedValue transform failing on CDATA elements
> ----------------------------------------------------------
>
>                 Key: WW-2234
>                 URL: https://issues.apache.org/struts/browse/WW-2234
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: Tomcat 6.0.14
> Struts 2.0.9
> JDK 1.5.0_11
> Xalan 2.7.0
>            Reporter: Stewart Witchalls
>            Priority: Minor
>             Fix For: 2.1.3
>
>
> Xalan 2.7.0 (with bundled Xerces) installed into $JDK_HOME/jre/lib/endorsed and $TOMCAT_HOME/common/endorsed
> action config:
>         <action name="ShowDataFormDemo" class="ShowDataFormDemo">
>             <result type="xslt">
>             	<param name="location">/WEB-INF/xsl/CreateDataForm.xsl</param>
>             	<param name="exposedValue">presenterXml</param>
>             </result>
>         </action>
> ShowDataFormDemo.presenterXml code:
>   public org.w3c.dom.Document getPresenterXml() throws Exception
>   {
> 	final byte[] data = this.presenterXml.getBytes("UTF-8");
>     	final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>         final Document doc2 = factory.newDocumentBuilder().parse( new ByteArrayInputStream(data) );
>         // debug to see if XPATH works inside server
> 	final XPathFactory fact = XPathFactory.newInstance();
> 	final XPath xpath = fact.newXPath();
> 	final XPathExpression xexpr = xpath.compile( "count(//items/*)" );
> 	System.out.println( xexpr.evaluate( doc2.getDocumentElement(), XPathConstants.NUMBER ) );
> 	return doc2;
>   }
> XML:
> <data>
> <items>
> <heading inline="true">
> <text><![CDATA[Data form example]]></text></heading>
> <paragraph inline="true">
> <text><![CDATA[Some explanatory text.]]></text></paragraph>
> <subHeading inline="true">
> <text><![CDATA[Lists]]></text></subHeading>
> </items>
> </data>
> CreateDataForm.xsl fragment:
>     vendor = <xsl:value-of select="system-property('xsl:vendor')"/>
>     vendor-url = <xsl:value-of select="system-property('xsl:vendor-url')"/>
>     xslt-version = <xsl:value-of select="system-property('xsl:version')"/>
>     count(items) = <xsl:value-of select="count(//items/*)"/>
> XPath in code works and returns correct count (aka. 3).
> However, same xpath in CreateDataForm.xsl transform fails and only returns 1. Also, transform not able to obtain CDATA values (ie. displays nothing when "text" element selected).
> I've removed + added rows to the XML. The CreateDataForm.xsl transform always says count = "1". It looks like it cannot see past the first CDATA section.
> If I remove the CDATA sections (ie. encode the element data as XML encoded strings), transform xpath works??!!
> I've checked classpaths and can confirm that the endorsed Xalan libraries are being picked up.
> I've even run the transform inside the action itself. It worked as expected.
> I can work around this by removing the CDATA sections from the XML, but I've spent the last few days going mad. Just cannot see what's going wrong.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2234) XSLTResut.exposedValue transform failing on CDATA elements

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44456#action_44456 ] 

Dave Newton commented on WW-2234:
---------------------------------

Really? Weird.

As Musachy said the XSL result doesn't expect an XML document, but an action property. See the sample in showcase.

On the XSL Result doc page [1] there are a few hints:

- "Xalan would still iterate through every property of your action  [...]"
- "This example will output the username by using getUsername on your action class: [...]"
- "In the following example the XSLT result would only walk through action's properties without their childs. [...]"

[1] http://struts.apache.org/2.x/docs/xsl-result.html

> XSLTResut.exposedValue transform failing on CDATA elements
> ----------------------------------------------------------
>
>                 Key: WW-2234
>                 URL: https://issues.apache.org/struts/browse/WW-2234
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: Tomcat 6.0.14
> Struts 2.0.9
> JDK 1.5.0_11
> Xalan 2.7.0
>            Reporter: Stewart Witchalls
>            Priority: Minor
>             Fix For: 2.1.3
>
>
> Xalan 2.7.0 (with bundled Xerces) installed into $JDK_HOME/jre/lib/endorsed and $TOMCAT_HOME/common/endorsed
> action config:
>         <action name="ShowDataFormDemo" class="ShowDataFormDemo">
>             <result type="xslt">
>             	<param name="location">/WEB-INF/xsl/CreateDataForm.xsl</param>
>             	<param name="exposedValue">presenterXml</param>
>             </result>
>         </action>
> ShowDataFormDemo.presenterXml code:
>   public org.w3c.dom.Document getPresenterXml() throws Exception
>   {
> 	final byte[] data = this.presenterXml.getBytes("UTF-8");
>     	final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>         final Document doc2 = factory.newDocumentBuilder().parse( new ByteArrayInputStream(data) );
>         // debug to see if XPATH works inside server
> 	final XPathFactory fact = XPathFactory.newInstance();
> 	final XPath xpath = fact.newXPath();
> 	final XPathExpression xexpr = xpath.compile( "count(//items/*)" );
> 	System.out.println( xexpr.evaluate( doc2.getDocumentElement(), XPathConstants.NUMBER ) );
> 	return doc2;
>   }
> XML:
> <data>
> <items>
> <heading inline="true">
> <text><![CDATA[Data form example]]></text></heading>
> <paragraph inline="true">
> <text><![CDATA[Some explanatory text.]]></text></paragraph>
> <subHeading inline="true">
> <text><![CDATA[Lists]]></text></subHeading>
> </items>
> </data>
> CreateDataForm.xsl fragment:
>     vendor = <xsl:value-of select="system-property('xsl:vendor')"/>
>     vendor-url = <xsl:value-of select="system-property('xsl:vendor-url')"/>
>     xslt-version = <xsl:value-of select="system-property('xsl:version')"/>
>     count(items) = <xsl:value-of select="count(//items/*)"/>
> XPath in code works and returns correct count (aka. 3).
> However, same xpath in CreateDataForm.xsl transform fails and only returns 1. Also, transform not able to obtain CDATA values (ie. displays nothing when "text" element selected).
> I've removed + added rows to the XML. The CreateDataForm.xsl transform always says count = "1". It looks like it cannot see past the first CDATA section.
> If I remove the CDATA sections (ie. encode the element data as XML encoded strings), transform xpath works??!!
> I've checked classpaths and can confirm that the endorsed Xalan libraries are being picked up.
> I've even run the transform inside the action itself. It worked as expected.
> I can work around this by removing the CDATA sections from the XML, but I've spent the last few days going mad. Just cannot see what's going wrong.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2234) XSLTResut.exposedValue transform failing on CDATA elements

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2234?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso updated WW-2234:
--------------------------------

    Fix Version/s:     (was: 2.1.3)
                   Future

I looked at this again and I can't figure out what is going on, moving to future

> XSLTResut.exposedValue transform failing on CDATA elements
> ----------------------------------------------------------
>
>                 Key: WW-2234
>                 URL: https://issues.apache.org/struts/browse/WW-2234
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: Tomcat 6.0.14
> Struts 2.0.9
> JDK 1.5.0_11
> Xalan 2.7.0
>            Reporter: Stewart Witchalls
>            Priority: Minor
>             Fix For: Future
>
>
> Xalan 2.7.0 (with bundled Xerces) installed into $JDK_HOME/jre/lib/endorsed and $TOMCAT_HOME/common/endorsed
> action config:
>         <action name="ShowDataFormDemo" class="ShowDataFormDemo">
>             <result type="xslt">
>             	<param name="location">/WEB-INF/xsl/CreateDataForm.xsl</param>
>             	<param name="exposedValue">presenterXml</param>
>             </result>
>         </action>
> ShowDataFormDemo.presenterXml code:
>   public org.w3c.dom.Document getPresenterXml() throws Exception
>   {
> 	final byte[] data = this.presenterXml.getBytes("UTF-8");
>     	final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>         final Document doc2 = factory.newDocumentBuilder().parse( new ByteArrayInputStream(data) );
>         // debug to see if XPATH works inside server
> 	final XPathFactory fact = XPathFactory.newInstance();
> 	final XPath xpath = fact.newXPath();
> 	final XPathExpression xexpr = xpath.compile( "count(//items/*)" );
> 	System.out.println( xexpr.evaluate( doc2.getDocumentElement(), XPathConstants.NUMBER ) );
> 	return doc2;
>   }
> XML:
> <data>
> <items>
> <heading inline="true">
> <text><![CDATA[Data form example]]></text></heading>
> <paragraph inline="true">
> <text><![CDATA[Some explanatory text.]]></text></paragraph>
> <subHeading inline="true">
> <text><![CDATA[Lists]]></text></subHeading>
> </items>
> </data>
> CreateDataForm.xsl fragment:
>     vendor = <xsl:value-of select="system-property('xsl:vendor')"/>
>     vendor-url = <xsl:value-of select="system-property('xsl:vendor-url')"/>
>     xslt-version = <xsl:value-of select="system-property('xsl:version')"/>
>     count(items) = <xsl:value-of select="count(//items/*)"/>
> XPath in code works and returns correct count (aka. 3).
> However, same xpath in CreateDataForm.xsl transform fails and only returns 1. Also, transform not able to obtain CDATA values (ie. displays nothing when "text" element selected).
> I've removed + added rows to the XML. The CreateDataForm.xsl transform always says count = "1". It looks like it cannot see past the first CDATA section.
> If I remove the CDATA sections (ie. encode the element data as XML encoded strings), transform xpath works??!!
> I've checked classpaths and can confirm that the endorsed Xalan libraries are being picked up.
> I've even run the transform inside the action itself. It worked as expected.
> I can work around this by removing the CDATA sections from the XML, but I've spent the last few days going mad. Just cannot see what's going wrong.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2234) XSLTResut.exposedValue transform failing on CDATA elements

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44444#action_44444 ] 

Dave Newton commented on WW-2234:
---------------------------------

This looks like a misunderstanding of the XSLT result, similar to one recently on struts-user.

Perhaps the documentation needs to be made a bit more clear.

> XSLTResut.exposedValue transform failing on CDATA elements
> ----------------------------------------------------------
>
>                 Key: WW-2234
>                 URL: https://issues.apache.org/struts/browse/WW-2234
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: Tomcat 6.0.14
> Struts 2.0.9
> JDK 1.5.0_11
> Xalan 2.7.0
>            Reporter: Stewart Witchalls
>            Priority: Minor
>             Fix For: 2.1.3
>
>
> Xalan 2.7.0 (with bundled Xerces) installed into $JDK_HOME/jre/lib/endorsed and $TOMCAT_HOME/common/endorsed
> action config:
>         <action name="ShowDataFormDemo" class="ShowDataFormDemo">
>             <result type="xslt">
>             	<param name="location">/WEB-INF/xsl/CreateDataForm.xsl</param>
>             	<param name="exposedValue">presenterXml</param>
>             </result>
>         </action>
> ShowDataFormDemo.presenterXml code:
>   public org.w3c.dom.Document getPresenterXml() throws Exception
>   {
> 	final byte[] data = this.presenterXml.getBytes("UTF-8");
>     	final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>         final Document doc2 = factory.newDocumentBuilder().parse( new ByteArrayInputStream(data) );
>         // debug to see if XPATH works inside server
> 	final XPathFactory fact = XPathFactory.newInstance();
> 	final XPath xpath = fact.newXPath();
> 	final XPathExpression xexpr = xpath.compile( "count(//items/*)" );
> 	System.out.println( xexpr.evaluate( doc2.getDocumentElement(), XPathConstants.NUMBER ) );
> 	return doc2;
>   }
> XML:
> <data>
> <items>
> <heading inline="true">
> <text><![CDATA[Data form example]]></text></heading>
> <paragraph inline="true">
> <text><![CDATA[Some explanatory text.]]></text></paragraph>
> <subHeading inline="true">
> <text><![CDATA[Lists]]></text></subHeading>
> </items>
> </data>
> CreateDataForm.xsl fragment:
>     vendor = <xsl:value-of select="system-property('xsl:vendor')"/>
>     vendor-url = <xsl:value-of select="system-property('xsl:vendor-url')"/>
>     xslt-version = <xsl:value-of select="system-property('xsl:version')"/>
>     count(items) = <xsl:value-of select="count(//items/*)"/>
> XPath in code works and returns correct count (aka. 3).
> However, same xpath in CreateDataForm.xsl transform fails and only returns 1. Also, transform not able to obtain CDATA values (ie. displays nothing when "text" element selected).
> I've removed + added rows to the XML. The CreateDataForm.xsl transform always says count = "1". It looks like it cannot see past the first CDATA section.
> If I remove the CDATA sections (ie. encode the element data as XML encoded strings), transform xpath works??!!
> I've checked classpaths and can confirm that the endorsed Xalan libraries are being picked up.
> I've even run the transform inside the action itself. It worked as expected.
> I can work around this by removing the CDATA sections from the XML, but I've spent the last few days going mad. Just cannot see what's going wrong.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2234) XSLTResut.exposedValue transform failing on CDATA elements

Posted by "Stewart Witchalls (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44459#action_44459 ] 

Stewart Witchalls commented on WW-2234:
---------------------------------------

XSLTResult config is ...

        <action name="ShowDataFormDemo" class="ShowDataFormDemo"> 
            <result type="xslt"> 
             <param name="location">/WEB-INF/xsl/CreateDataForm.xsl</param> 
             <param name="exposedValue">presenterXml</param> 
            </result> 
        </action> 

(I included the above with code and XML fragments in the report's original description).

You can configure the result to "obtain the XML to be transformed" from a bean property. That property is set to "ShowDataFormDemo.presenterXml ". Queries inside the getter work (see code fragment in report description). The same query run inside the XSLT fails when CDATA sections are present (see XSLT + XML example in report description)





> XSLTResut.exposedValue transform failing on CDATA elements
> ----------------------------------------------------------
>
>                 Key: WW-2234
>                 URL: https://issues.apache.org/struts/browse/WW-2234
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.9
>         Environment: Tomcat 6.0.14
> Struts 2.0.9
> JDK 1.5.0_11
> Xalan 2.7.0
>            Reporter: Stewart Witchalls
>            Priority: Minor
>             Fix For: 2.1.3
>
>
> Xalan 2.7.0 (with bundled Xerces) installed into $JDK_HOME/jre/lib/endorsed and $TOMCAT_HOME/common/endorsed
> action config:
>         <action name="ShowDataFormDemo" class="ShowDataFormDemo">
>             <result type="xslt">
>             	<param name="location">/WEB-INF/xsl/CreateDataForm.xsl</param>
>             	<param name="exposedValue">presenterXml</param>
>             </result>
>         </action>
> ShowDataFormDemo.presenterXml code:
>   public org.w3c.dom.Document getPresenterXml() throws Exception
>   {
> 	final byte[] data = this.presenterXml.getBytes("UTF-8");
>     	final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>         final Document doc2 = factory.newDocumentBuilder().parse( new ByteArrayInputStream(data) );
>         // debug to see if XPATH works inside server
> 	final XPathFactory fact = XPathFactory.newInstance();
> 	final XPath xpath = fact.newXPath();
> 	final XPathExpression xexpr = xpath.compile( "count(//items/*)" );
> 	System.out.println( xexpr.evaluate( doc2.getDocumentElement(), XPathConstants.NUMBER ) );
> 	return doc2;
>   }
> XML:
> <data>
> <items>
> <heading inline="true">
> <text><![CDATA[Data form example]]></text></heading>
> <paragraph inline="true">
> <text><![CDATA[Some explanatory text.]]></text></paragraph>
> <subHeading inline="true">
> <text><![CDATA[Lists]]></text></subHeading>
> </items>
> </data>
> CreateDataForm.xsl fragment:
>     vendor = <xsl:value-of select="system-property('xsl:vendor')"/>
>     vendor-url = <xsl:value-of select="system-property('xsl:vendor-url')"/>
>     xslt-version = <xsl:value-of select="system-property('xsl:version')"/>
>     count(items) = <xsl:value-of select="count(//items/*)"/>
> XPath in code works and returns correct count (aka. 3).
> However, same xpath in CreateDataForm.xsl transform fails and only returns 1. Also, transform not able to obtain CDATA values (ie. displays nothing when "text" element selected).
> I've removed + added rows to the XML. The CreateDataForm.xsl transform always says count = "1". It looks like it cannot see past the first CDATA section.
> If I remove the CDATA sections (ie. encode the element data as XML encoded strings), transform xpath works??!!
> I've checked classpaths and can confirm that the endorsed Xalan libraries are being picked up.
> I've even run the transform inside the action itself. It worked as expected.
> I can work around this by removing the CDATA sections from the XML, but I've spent the last few days going mad. Just cannot see what's going wrong.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.