garry_3 Posted July 24, 2017 Share Posted July 24, 2017 The documentaion on XML datasources says:To move to the parent value of the current node (for example, to determine the category to which a person belongs), use a slightly different syntax:ancestor::category/@nameThe ancestor keyword indicates that you are referring to a parent node of the current node;A simplified example of the data is as follows:<data> <meta> <unrelated> <id>18</id> <description>description</description> <year>2014</year> <code>2014GBN</code> </unrelated> <different> <id>3</id> <label>My label</label> </different> </meta> <person> <id>1308</id> <code>Amj/3177</code> <surname>Amj</surname> <firstname>Jbswjt</firstname> <middlename>Pbvm</middlename> <gender>m</gender> ..... <username>jbswjt/bmj</username> <parent_node> <id>1467</id> <title>A title</title> <priority>99</priority> <code>09EN</subject_code> <id>109</subject_id> <description>English</subject_description> <department_code>6</subject_department_code> <node> <id>39480</id> <template_id>1</template_id> <different_id>3</different_id> <unrelated_id>18</unrelatedid> .... </node> </parent_node> <parent_node> .... <node> .... </node> </parent_node> </person></data>[/code]How do you reference an element that is in an "unrelated" node? i.e. how do I reference /data/meta/unrelated/code from node ?The datasource for the subreport is:<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("person[id]/parent_node/node")]]></dataSourceExpression>[/code]Any assistance would be greatly appreciated. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now