[
https://issues.apache.org/jira/browse/XALANJ-2474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17735942#comment-17735942
]
Joe Kesselman edited comment on XALANJ-2474 at 6/22/23 4:58 AM:
----------------------------------------------------------------
Simplifying this down drastically, renaming it {*}jalan-xira-2474.{*}{*}, and
using my *identitext.xsl{*} transformation to roughly dump (non-indented)
content of a node in the messages.
The first computed path they try to execute expands to:
{code:java}
"document('jira-xalanj-2474.xml')/*/NetworkElement[Name='FTMYFLXABB0' and
Description='Ascend CBX 500' and Id='1000000010' and CreationTime='' and
LastUpdatedTime='' and Enabled='EnableType.Enabled' and ManagementAddress=''
and LastDiscovered='2002-05-11 21:21:56.0' and FirstDiscoveryFailure='' and
LastDiscoveryFailure='' and NumDiscoveryFailures='0' and
NemClass='com.comanage.truesource.nem.naviscore.NavisCoreNem' and
ContactAddress='Ipv4Address:172.20.254.1' and Vendor='Lucent' and Model='CBX
500' and HardwareVersion='03' and SoftwareVersion='04.02.00.00' and
SerialNumber='' and Supplier='' and PartNumber='' and Clei='' and Label='' and
Credibility='CredibilityLevel.Medium' and SlotCount='4' and
AvailableSlotCount='-1' and HostAgent[@xlink:href='nil'] and
HostSystem[@xlink:href='nil'] and Host[@xlink:href='nil']]"
{code}
If I invoke the path "normally" from the stylesheet, it returns the correct
node.
{code:java}
<xsl:message>
<xsl:text>Standard selection, literal path string: </xsl:text>
<xsl:apply-templates mode="identitext"
select="document('jira-xalanj-2474.xml')/*/NetworkElement[Name='FTMYFLXABB0'
and Description='Ascend CBX 500' and Id='1000000010' and CreationTime='' and
LastUpdatedTime='' and Enabled='EnableType.Enabled' and ManagementAddress=''
and LastDiscovered='2002-05-11 21:21:56.0' and FirstDiscoveryFailure='' and
LastDiscoveryFailure='' and NumDiscoveryFailures='0' and
NemClass='com.comanage.truesource.nem.naviscore.NavisCoreNem' and
ContactAddress='Ipv4Address:172.20.254.1' and Vendor='Lucent' and Model='CBX
500' and HardwareVersion='03' and SoftwareVersion='04.02.00.00' and
SerialNumber='' and Supplier='' and PartNumber='' and Clei='' and Label='' and
Credibility='CredibilityLevel.Medium' and SlotCount='4' and
AvailableSlotCount='-1' and HostAgent[@xlink:href='nil'] and
HostSystem[@xlink:href='nil'] and Host[@xlink:href='nil']]"/>
</xsl:message>
{code}
produces
{code:java}
file:///home/keshlam/git/xalan-test/tests/jira/jira-xalanj-2474.xslt; Line #20;
Column #18; Standard selection, literal path string: <NetworkElement
id="NetworkElement_1" package="com.comanage.truesource.schema.physical">
<Name>FTMYFLXABB0 </Name>
<Description>Ascend CBX 500 </Description>
<Id>1000000010 </Id>
<HostAgent xlink:type="simple" xlink:href="nil"> </HostAgent>
<HostSystem xlink:type="simple" xlink:href="nil"> </HostSystem>
<Host xlink:type="simple" xlink:href="nil"> </Host>
<CreationTime> </CreationTime>
<LastUpdatedTime> </LastUpdatedTime>
<Enabled>EnableType.Enabled </Enabled>
<ManagementAddress> </ManagementAddress>
<LastDiscovered>2002-05-11 21:21:56.0 </LastDiscovered>
<FirstDiscoveryFailure> </FirstDiscoveryFailure>
<LastDiscoveryFailure> </LastDiscoveryFailure>
<NumDiscoveryFailures>0 </NumDiscoveryFailures>
<NemClass>com.comanage.truesource.nem.naviscore.NavisCoreNem </NemClass>
<ContactAddress>Ipv4Address:172.20.254.1 </ContactAddress>
<Vendor>Lucent </Vendor>
<Model>CBX 500 </Model>
<HardwareVersion>03 </HardwareVersion>
<SoftwareVersion>04.02.00.00 </SoftwareVersion>
<SerialNumber> </SerialNumber>
<Supplier> </Supplier>
<PartNumber> </PartNumber>
<Clei> </Clei>
<Label> </Label>
<Credibility>CredibilityLevel.Medium </Credibility>
<SlotCount>4 </SlotCount>
<AvailableSlotCount>-1 </AvailableSlotCount>
</NetworkElement>{code}
An attempt to put that string into a *$path* variable and then call
{*}xalan:execute(string($path)){*}, as they are doing, does not.
{code:java}
<xsl:variable name="path">
<xsl:text>document('jira-xalanj-2474.xml')/*/NetworkElement[Name='FTMYFLXABB0'
and Description='Ascend CBX 500' and Id='1000000010' and CreationTime='' and
LastUpdatedTime='' and Enabled='EnableType.Enabled' and ManagementAddress=''
and LastDiscovered='2002-05-11 21:21:56.0' and FirstDiscoveryFailure='' and
LastDiscoveryFailure='' and NumDiscoveryFailures='0' and
NemClass='com.comanage.truesource.nem.naviscore.NavisCoreNem' and
ContactAddress='Ipv4Address:172.20.254.1' and Vendor='Lucent' and Model='CBX
500' and HardwareVersion='03' and SoftwareVersion='04.02.00.00' and
SerialNumber='' and Supplier='' and PartNumber='' and Clei='' and Label='' and
Credibility='CredibilityLevel.Medium' and SlotCount='4' and
AvailableSlotCount='-1' and HostAgent[@xlink:href='nil'] and
HostSystem[@xlink:href='nil'] and Host[@xlink:href='nil']]</xsl:text>
</xsl:variable>
<xsl:message>
<xsl:text>Path string: </xsl:text>
<xsl:value-of select="$path"/>
</xsl:message>
<xsl:variable name="targetNode" select="xalan:evaluate(string($path))"/>
<xsl:message>
<xsl:text>Eval(string($path)): </xsl:text>
<xsl:apply-templates mode="identitext" select="$targetNode"/>
</xsl:message>
{code}
yields
{code:java}
file:///home/keshlam/git/xalan-test/tests/jira/jira-xalanj-2474.xslt; Line #30;
Column #18; Path string:
document('jira-xalanj-2474.xml')/*/NetworkElement[Name='FTMYFLXABB0' and
Description='Ascend CBX 500' and Id='1000000010' and CreationTime='' and
LastUpdatedTime='' and Enabled='EnableType.Enabled' and ManagementAddress=''
and LastDiscovered='2002-05-11 21:21:56.0' and FirstDiscoveryFailure='' and
LastDiscoveryFailure='' and NumDiscoveryFailures='0' and
NemClass='com.comanage.truesource.nem.naviscore.NavisCoreNem' and
ContactAddress='Ipv4Address:172.20.254.1' and Vendor='Lucent' and Model='CBX
500' and HardwareVersion='03' and SoftwareVersion='04.02.00.00' and
SerialNumber='' and Supplier='' and PartNumber='' and Clei='' and Label='' and
Credibility='CredibilityLevel.Medium' and SlotCount='4' and
AvailableSlotCount='-1' and HostAgent[@xlink:href='nil'] and
HostSystem[@xlink:href='nil'] and Host[@xlink:href='nil']]
file:///home/keshlam/git/xalan-test/tests/jira/jira-xalanj-2474.xslt; Line #36;
Column #18; Eval(string($path)):
{code}
Simplifying the path string to just the *document()* call shows that this isn't
even getting that far:
{code:java}
<xsl:message>Does it work just with document()?</xsl:message>
<xsl:variable name="path">
<xsl:text>document('jira-xalanj-2474.xml')</xsl:text> -->
</xsl:variable>
<xsl:message>
<xsl:text>Path string: </xsl:text>
<xsl:value-of select="$path"/>
</xsl:message>
<xsl:variable name="targetNode" select="xalan:evaluate(string($path))"/>
<xsl:message>
<xsl:text>Eval(string($path)): </xsl:text>
<xsl:apply-templates mode="identitext" select="$targetNode"/>
</xsl:message>{code}
yields
{code:java}
file:///home/keshlam/git/xalan-test/tests/jira/jira-xalanj-2474.xslt; Line #43;
Column #18; Does it work just with document()?
file:///home/keshlam/git/xalan-test/tests/jira/jira-xalanj-2474.xslt; Line #47;
Column #18; Path string: document('jira-xalanj-2474.xml')
file:///home/keshlam/git/xalan-test/tests/jira/jira-xalanj-2474.xslt; Line #52;
Column #18; Eval(string($path)):{code}
So it looks like the root problem is either that *xalan:evaluate()* isn't
working at all for a string supplied in a variable, or it isn't supporting
*document()* within that string.
Tried removing the *string()* call, made no difference.
But this is now simple enough that it's worth considering debugging into.
was (Author: JIRAUSER285361):
Simplifying this down drastically, renaming it {*}jalan-xira-2474.*{*}, and
using my *identitext.xsl* transformation to roughly dump (non-indented) content
of a node in the messages.
The first computed path they try to execute expands to:
{code:java}
"document('jira-xalanj-2474.xml')/*/NetworkElement[Name='FTMYFLXABB0' and
Description='Ascend CBX 500' and Id='1000000010' and CreationTime='' and
LastUpdatedTime='' and Enabled='EnableType.Enabled' and ManagementAddress=''
and LastDiscovered='2002-05-11 21:21:56.0' and FirstDiscoveryFailure='' and
LastDiscoveryFailure='' and NumDiscoveryFailures='0' and
NemClass='com.comanage.truesource.nem.naviscore.NavisCoreNem' and
ContactAddress='Ipv4Address:172.20.254.1' and Vendor='Lucent' and Model='CBX
500' and HardwareVersion='03' and SoftwareVersion='04.02.00.00' and
SerialNumber='' and Supplier='' and PartNumber='' and Clei='' and Label='' and
Credibility='CredibilityLevel.Medium' and SlotCount='4' and
AvailableSlotCount='-1' and HostAgent[@xlink:href='nil'] and
HostSystem[@xlink:href='nil'] and Host[@xlink:href='nil']]"
{code}
If I invoke the path "normally" from the stylesheet, it returns the correct
node.
{code:java}
<xsl:message>
<xsl:text>Standard selection, literal path string: </xsl:text>
<xsl:apply-templates mode="identitext"
select="document('jira-xalanj-2474.xml')/*/NetworkElement[Name='FTMYFLXABB0'
and Description='Ascend CBX 500' and Id='1000000010' and CreationTime='' and
LastUpdatedTime='' and Enabled='EnableType.Enabled' and ManagementAddress=''
and LastDiscovered='2002-05-11 21:21:56.0' and FirstDiscoveryFailure='' and
LastDiscoveryFailure='' and NumDiscoveryFailures='0' and
NemClass='com.comanage.truesource.nem.naviscore.NavisCoreNem' and
ContactAddress='Ipv4Address:172.20.254.1' and Vendor='Lucent' and Model='CBX
500' and HardwareVersion='03' and SoftwareVersion='04.02.00.00' and
SerialNumber='' and Supplier='' and PartNumber='' and Clei='' and Label='' and
Credibility='CredibilityLevel.Medium' and SlotCount='4' and
AvailableSlotCount='-1' and HostAgent[@xlink:href='nil'] and
HostSystem[@xlink:href='nil'] and Host[@xlink:href='nil']]"/>
</xsl:message>
{code}
produces
{code:java}
file:///home/keshlam/git/xalan-test/tests/jira/jira-xalanj-2474.xslt; Line #20;
Column #18; Standard selection, literal path string: <NetworkElement
id="NetworkElement_1" package="com.comanage.truesource.schema.physical">
<Name>FTMYFLXABB0 </Name>
<Description>Ascend CBX 500 </Description>
<Id>1000000010 </Id>
<HostAgent xlink:type="simple" xlink:href="nil"> </HostAgent>
<HostSystem xlink:type="simple" xlink:href="nil"> </HostSystem>
<Host xlink:type="simple" xlink:href="nil"> </Host>
<CreationTime> </CreationTime>
<LastUpdatedTime> </LastUpdatedTime>
<Enabled>EnableType.Enabled </Enabled>
<ManagementAddress> </ManagementAddress>
<LastDiscovered>2002-05-11 21:21:56.0 </LastDiscovered>
<FirstDiscoveryFailure> </FirstDiscoveryFailure>
<LastDiscoveryFailure> </LastDiscoveryFailure>
<NumDiscoveryFailures>0 </NumDiscoveryFailures>
<NemClass>com.comanage.truesource.nem.naviscore.NavisCoreNem </NemClass>
<ContactAddress>Ipv4Address:172.20.254.1 </ContactAddress>
<Vendor>Lucent </Vendor>
<Model>CBX 500 </Model>
<HardwareVersion>03 </HardwareVersion>
<SoftwareVersion>04.02.00.00 </SoftwareVersion>
<SerialNumber> </SerialNumber>
<Supplier> </Supplier>
<PartNumber> </PartNumber>
<Clei> </Clei>
<Label> </Label>
<Credibility>CredibilityLevel.Medium </Credibility>
<SlotCount>4 </SlotCount>
<AvailableSlotCount>-1 </AvailableSlotCount>
</NetworkElement>{code}
An attempt to put that string into a *$path* variable and then call
{*}xalan:execute(string($path)){*}, as they are doing, does not.
{code:java}
<xsl:variable name="path">
<xsl:text>document('jira-xalanj-2474.xml')/*/NetworkElement[Name='FTMYFLXABB0'
and Description='Ascend CBX 500' and Id='1000000010' and CreationTime='' and
LastUpdatedTime='' and Enabled='EnableType.Enabled' and ManagementAddress=''
and LastDiscovered='2002-05-11 21:21:56.0' and FirstDiscoveryFailure='' and
LastDiscoveryFailure='' and NumDiscoveryFailures='0' and
NemClass='com.comanage.truesource.nem.naviscore.NavisCoreNem' and
ContactAddress='Ipv4Address:172.20.254.1' and Vendor='Lucent' and Model='CBX
500' and HardwareVersion='03' and SoftwareVersion='04.02.00.00' and
SerialNumber='' and Supplier='' and PartNumber='' and Clei='' and Label='' and
Credibility='CredibilityLevel.Medium' and SlotCount='4' and
AvailableSlotCount='-1' and HostAgent[@xlink:href='nil'] and
HostSystem[@xlink:href='nil'] and Host[@xlink:href='nil']]</xsl:text>
</xsl:variable>
<xsl:message>
<xsl:text>Path string: </xsl:text>
<xsl:value-of select="$path"/>
</xsl:message>
<xsl:variable name="targetNode" select="xalan:evaluate(string($path))"/>
<xsl:message>
<xsl:text>Eval(string($path)): </xsl:text>
<xsl:apply-templates mode="identitext" select="$targetNode"/>
</xsl:message>
{code}
yields
{code:java}
file:///home/keshlam/git/xalan-test/tests/jira/jira-xalanj-2474.xslt; Line #30;
Column #18; Path string:
document('jira-xalanj-2474.xml')/*/NetworkElement[Name='FTMYFLXABB0' and
Description='Ascend CBX 500' and Id='1000000010' and CreationTime='' and
LastUpdatedTime='' and Enabled='EnableType.Enabled' and ManagementAddress=''
and LastDiscovered='2002-05-11 21:21:56.0' and FirstDiscoveryFailure='' and
LastDiscoveryFailure='' and NumDiscoveryFailures='0' and
NemClass='com.comanage.truesource.nem.naviscore.NavisCoreNem' and
ContactAddress='Ipv4Address:172.20.254.1' and Vendor='Lucent' and Model='CBX
500' and HardwareVersion='03' and SoftwareVersion='04.02.00.00' and
SerialNumber='' and Supplier='' and PartNumber='' and Clei='' and Label='' and
Credibility='CredibilityLevel.Medium' and SlotCount='4' and
AvailableSlotCount='-1' and HostAgent[@xlink:href='nil'] and
HostSystem[@xlink:href='nil'] and Host[@xlink:href='nil']]
file:///home/keshlam/git/xalan-test/tests/jira/jira-xalanj-2474.xslt; Line #36;
Column #18; Eval(string($path)):
{code}
Simplifying the path string to just the *document()* call shows that this isn't
even getting that far:
{code:java}
<xsl:message>Does it work just with document()?</xsl:message>
<xsl:variable name="path">
<xsl:text>document('jira-xalanj-2474.xml')</xsl:text> -->
</xsl:variable>
<xsl:message>
<xsl:text>Path string: </xsl:text>
<xsl:value-of select="$path"/>
</xsl:message>
<xsl:variable name="targetNode" select="xalan:evaluate(string($path))"/>
<xsl:message>
<xsl:text>Eval(string($path)): </xsl:text>
<xsl:apply-templates mode="identitext" select="$targetNode"/>
</xsl:message>{code}
yields
{code:java}
file:///home/keshlam/git/xalan-test/tests/jira/jira-xalanj-2474.xslt; Line #43;
Column #18; Does it work just with document()?
file:///home/keshlam/git/xalan-test/tests/jira/jira-xalanj-2474.xslt; Line #47;
Column #18; Path string: document('jira-xalanj-2474.xml')
file:///home/keshlam/git/xalan-test/tests/jira/jira-xalanj-2474.xslt; Line #52;
Column #18; Eval(string($path)):{code}
So it looks like the root problem is either that *xalan:evaluate()* isn't
working at all for a string supplied in a variable, or it isn't supporting
*document()* within that string.
Tried removing the *string()* call, made no difference.
But this is now simple enough that it's worth considering debugging into.
NOTE: It's also simple enough that I can go back to just outputting the results
rather than using my *identitext* kluge to convert them to text and put them
into messages. I'll do that and post the simplified testcase.
> document() function returns different values with xalan version 2.7.1. and
> 2.6.0.
> ---------------------------------------------------------------------------------
>
> Key: XALANJ-2474
> URL: https://issues.apache.org/jira/browse/XALANJ-2474
> Project: XalanJ2
> Issue Type: Bug
> Security Level: No security risk; visible to anyone(Ordinary problems in
> Xalan projects. Anybody can view the issue.)
> Affects Versions: 2.7.1
> Environment: Windows, using command line transform of xalan.
> Reporter: pavankumar
> Priority: Blocker
> Attachments: input.xml, transform.xslt
>
>
> xslt document() function returns duplicate and improper values with 2.7.1.
> where as the same code works with 2.6.0.
> Info : document and evaluate functions are used in xslt and there were other
> slightly inconsistent behaviour also for 2 versions in terms of syntax and
> all. and xlink:href is getting nil values in 2.7.1
> document result contained by path variable line 93 - transform.xsl is the one
> causing problem. and and when printed, it outputs different values with
> different versions.
> Executed using xalan CLI
> C:\>java org.apache.xalan.xslt.Process -IN "C:\input.xml" -XSL
> "C:\transform.xslt" -OUT new.html -PARAM global.result input.xml
> attaching the files.transform.xslt and input.xml
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]