8000 Bug: //a[@b='../../@b'], Condition expression with parent query(../../) expression filter · Issue #75 · antchfx/xpath · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Bug: //a[@b='../../@b'], Condition expression with parent query(../../) expression filter #75
Closed
@zhengchun

Description

@zhengchun

This bug from #73.

s := `<?xml version="1.0" encoding="UTF-8"?>
	<?xml-stylesheet type="text/xsl" href="MeasDataCollection.xsl"?>
	<measCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec">
		<measData>
			<managedElement localDn="foobar.example.com" />
			<measInfo measInfoId="metric_name">
				<measType p="1">field1</measType>
				<measType p="2">field2</measType>
				<measValue measObjLdn="identifier">
					<r p="1">31854</r>
					<r p="2">159773</r>
				</measValue>
			</measInfo>
			<measInfo measInfoId="metric_name2">
				<measType p="1">field3</measType>
				<measType p="2">field4</measType>
				<measValue measObjLdn="identifier">
					<r p="1">1234</r>
					<r p="2">567</r>
				</measValue>
			</measInfo>
		</measData>
	</measCollecFile>`

doc, _ := xmlquery.Parse(strings.NewReader(s))
list := xmlquery.Find(doc, "//r[@p=../../measType/@p]")
for _, n := range list {
    fmt.Println(n.OutputXML(true))
}

Expected(4 nodes):

<r p="1">31854</r>
<r p="2">159773</r>
<r p="1">1234</r>
<r p="2">567</r>

But actually:

<r p="1">31854</r>
<r p="1">1234</r>

only got 2 nodes, missing 159773 and 567

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0