Need to figure out xpath to get sibling node - xpath

I have to return a certain node that is a sibling to a node that I am using to select a certain parent of both nodes...
suppose...
<?xml version="1.0" encoding="utf-16"?>
<dataTemplateSpecification id="id1" name="name1">
<templates xmlns="">
<template>
<elements>
<element id="element0" name="PatientId" display="Patient ID" dataType="String" visable="true" readOnly="false" value="32">
<mapping path="//Template/TemplateData/ACOData/PATIENT_ID" />
<validation>
<rules>
<rule id="r0" test="#element0.value == ''">
<fail>
<html>
<b>Patient ID is null, value must be present</b>
</html>
</fail>
</rule>
</rules>
</validation>
</element>
<element id="element4" name="Active" display="ACTIVE" dataType="String" visable="true" readOnly="true" value="A">
<mapping path="//Template/TemplateData/ACOData/ACTIVE" />
<!--//Templates/Patient/sources/source/empi"/>-->
<validation>
<rules>
<rule id="r1" test="#element1.value == ''">
<fail>
<html>
<b>EMPI ID is null, value must be present</b>
</html>
</fail>
</rule>
</rules>
</validation>
</element>
<element id="element2" name="PopulationPatientID" display="Population Patient ID" dataType="String" visable="true" readOnly="true" enc="223" value="198">
<mapping path="//Template/TemplateData/ACOData/POPULATION_PATIENT_ID" />
<!--Patient/compositeID[./idType='populationPatientID']/id-->
<validation>
<rules>
<rule id="r1" test="#element1.value == ''">
<fail>
<html>
<b>EMPI ID is null, value must be present</b>
</html>
</fail>
</rule>
</rules>
</validation>
</element>
<element id="element1" name="EncounterId" display="Encounter ID" dataType="String" visable="true" readOnly="false" value="223">
<mapping path="//Template/TemplateData/ACOData/FOCUSED_READMISSIONS_ID" />
<validation>
<rules>
<rule id="r0" test="#element0.value == ''">
<fail>
<html>
<b>Patient ID is null, value must be present</b>
</html>
</fail>
</rule>
</rules>
</validation>
</element>
The Xpath I have right now currently only gets the right template. But I need the right element...
//dataTemplateSpecification/templates/template[./elements/element[#name="PopulationPatientID" and #value="198" and #enc="223"]]
I need to xpath to the node that has an attribute named "Active" Is that even possible? I was thinking I might need to drill backwords in the [] section... you know [./../../] where I would be selecting by a finer granularity before then... //dataTemplateSpecification/templates/template/elements/element[./../../] ect.. Does that make sense or am I completely rambling here? Any help would be appreciated. Thanks.

The reason you are getting the template instead of the element with your XPath search is because you are searching for template.
//dataTemplateSpecification/templates/template[./elements/element[#name="PopulationPatientID" and #value="198" and #enc="223"]]
If you want the element instead, you need to specify it before the predicate part of the XPath statement (the predicate being the part in [ ] or brackets).
Also, if you are looking for the element with the name attribute that has a value of "Active", you can specify it as part of your XPath statement.
Either one of the following statements will get the element with that has a name of "Active":
/dataTemplateSpecification/templates/template/elements/element[#name = 'Active']
//element[#name = 'Active']

Use:
/*/*/*/*/element
[#name="PopulationPatientID" and #value="198" and #enc="223"]
/preceding-sibling::element[1]
or even simpler:
/*/*/*/*/element[#name='Active']

#royerboat and #Dimitre Novatchev...
both of you guys had the right idea and it inspired me to get the Xpath that I needed...
//dataTemplateSpecification/templates/template[./elements/element[#name="PopulationPatientID" and #value="198" and #enc="223"]]//element[#name = 'Active']
That xpath is precisely what I need. Dimitre, I tried both of your sugestions and they came close, but no cigar. Thanks for the help guys.

Related

FHIR - Consent Resource - Giving Hl7.Fhir.Serialization.ComplexTypeReader error

I am not a techie but have assumed some responsibilities in someone's absence.
Trying to push below Consent FHIR Resource:
<Consent xmlns="http://hl7.org/fhir">
<id value="123" />
<status value="inactive" />
<scope>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/consentscope" />
<code value="patient-privacy" />
</coding>
</scope>
<category>
<coding>
<system value="http://loinc.org" />
<code value="59284-0" />
</coding>
</category>
<patient>
<reference value="Patient/41" />
<display value="John Stifiles" />
</patient>
<policyRule>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/consentpolicycodes" />
<code value="cric" />
</coding>
</policyRule>
<provision>
<type value="deny" />
<period>
<start value="2021-09-27" />
<end value="2021-09-27" />
</period>
</provision>
</Consent>
This is passed with no errors from inferno.healthit.gov/validator/ but when I run through my integrator (it hits HL7 validator), I get a variety of errors - Encountered unknown member 'Scope' or Encountered unknown member 'Patient', etc.
This is a Consent resource that conforms to FHIR version R4. Inferno runs FHIR R4 as well, so that works.
However, if you try and validate this resource against FHIR STU3, you will get the errors you mentioned, since the Consent resource structure significantly changed from STU3 to R4. Please check your integrator and make sure it runs FHIR R4 as well.

iis7.5, web.config how to redirect not exist file(page) to another page?

I'm using iis-7.5 and web.config file.
I want to redirect "somepage.asp?id=63" to "somepage/10.html".
My web.config is like this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="301 Redirect 2" stopProcessing="true">
<match url="somepage.asp?id=63" />
<action type="Redirect" url="somepage/10.html" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
it didn't work, when I change <match url="somepage.asp?id=63" /> to <match url="somepage.asp" />, (delete ?id=63) , it worked, why? how can i do?
As far as I know, the url rewrite match url pattern doesn't match query string.
If you want to redirect the url according to the query string, I suggest you could try to use condition.
More details, you could refer to below url rewrite rule:
<rule name="Redirect according to query string" stopProcessing="true">
<match url="somepage.asp" />
<conditions>
<add input="{QUERY_STRING}" pattern="id=63" />
</conditions>
<action type="Redirect" url="somepage/10.html" appendQueryString="false" />
</rule>

Formatting legend in Anychart included with Application Express

I am trying to format the legend within Application Express Anychart Flash chart. Here is the relevant XML section:
<legend enabled="true" position="Right" align="Near" elements_layout="Vertical">
<title enabled="true">
<text>Legend</text>
<font family="Tahoma" size="10" color="0x000000" />
</title>
<icon>
<marker enabled="true" />
</icon>
<font family="Tahoma" size="10" color="0x000000" />
</legend>
I am simply trying to add two line items, Sales and Tickets, to describe the lines in my chart with a correctly colored line icons but instead I get two generic entries - Value and Value. Can anyone help me sort out the proper code for this XML?
When I change it to the following:
<legend enabled="true" position="Right" align="Near" elements_layout="Vertical" ignore_auto_item="True">
<title enabled="true">
<text>Legend</text>
<font family="Tahoma" size="10" color="0x000000" />
</title>
<items>
<item>
<text>This is a test</text>
</icon></item>
<item><text>Item 2</text>
</item>
</items>
<icon>
<marker enabled="true" />
</icon>
<font family="Tahoma" size="10" color="0x000000" />
</legend>
This gives me the two series I want but no icon.
Please forgive my ignorance here. I still am not getting the simple legend I want. I am using two series queries, Total_Sales and Total_Tickets:
SELECT NULL Link,
trunc(tix.timestamp) AS label,
sum(tixp.Price) AS value
FROM LS_tickets tix LEFT OUTER JOIN
LS_ticket_prices tixP
ON tixp.series_prefix = tix.ticket_series
WHERE tix.event_id = :P145_event_id
and tix.event_id = tixp.event_id
and tix.voided_flag != 'Y'
GROUP BY trunc(tix.timestamp)
ORDER BY trunc(tix.timestamp) ASC
And
SELECT NULL Link,
trunc(tix.timestamp) AS label,
sum( tixp.quantity ) AS value
FROM LS_tickets tix LEFT OUTER JOIN
LS_ticket_prices tixP
ON tixp.series_prefix = tix.ticket_series
WHERE tix.event_id = :P145_event_id
and tix.event_id = tixp.event_id
and tix.voided_flag != 'Y'
GROUP BY trunc(tix.timestamp)
ORDER BY 1
But I am getting an empty legend whenever i try and add ICON information specific for each label as follows:
<legend enabled="true" position="Right" align="Near" elements_layout="Vertical" ignore_auto_item="True">
<title enabled="true">
<text>Legend</text>
<font family="Tahoma" size="10" color="0x000000" />
</title>
<icon><marker enabled="true" /></icon>
<items>
<item source="Series" series="Total_Sales">
<text>{%Icon} Sales</text>
</item>
<item source="Series" series="Total_Tickets"><text>{%Icon} Tickets</text>
</item>
</items>
<font family="Tahoma" size="10" color="0x000000" />
</legend>
It depends on what data structure you are using. You can specify what data should be shown in legend using these xml settings.
Each automatic item have attributes source which can be "Points" or "Series" and series, that specifies the series name:
http://www.anychart.com/products/anychart/docs/users-guide/index.html?legend-text-formatting.html#automatic-items
In case of custom line items you can add your own items with any information:
http://www.anychart.com/products/anychart/docs/users-guide/index.html?legend-text-formatting.html#custom-items
Here is a list of all keywords that you can use to format the items values:
http://www.anychart.com/products/anychart/docs/users-guide/index.html?legend-text-formatting.html#keywords
it looks like the issue occurs while apex working with the series, all of them are created with the name set to "VALUE. Here is a solution for the similar problem:
https://community.oracle.com/message/12637203#12637203

extract with multiple predicates and multiple predicates

I want to extract information from the jms-bus node. Specifically the busid,
//[local-name()='jms-bus'][#busid=//[local-name()='jms-listener']/#busidref]/#busid matches perfectly and returns quickstartGwChannel and quickstartESBChannel if the have matching providers and services.
However, I want to return the jms-bus(s) where it has a jms-listener is-gateway='true'
I am not sure where to put the 'and' clause. When I put it at the beginning //*[local-name()='jms-listener]/[#is-gateway='true']and .... it returns a boolean.
I need to extract from this xml
<providers>
<jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
<jms-bus busid="quickstartGwChannel">
<jms-message-filter
dest-type="QUEUE"
dest-name="queue/quickstart_helloworld_Request_gw"
/>
</jms-bus>
<jms-bus busid="quickstartEsbChannel">
<jms-message-filter
dest-type="QUEUE"
dest-name="queue/quickstart_helloworld_Request_esb"
/>
</jms-bus>
</jms-provider>
</providers>
<services>
<service
category="FirstServiceESB"
name="SimpleListener"
description="Hello World">
<listeners>
<jms-listener name="JMS-Gateway"
busidref="quickstartGwChannel"
is-gateway="true"
/>
<jms-listener name="helloWorld"
busidref="X12"
is-gateway="false"
/>
</listeners>
<actions mep="OneWay">
<action name="action1"
class="org.jboss.soa.esb.samples.quickstart.helloworld.MyJMSListenerAction"
process="displayMessage"
/>
<action name="action2" class="org.jboss.soa.esb.actions.SystemPrintln">
<property name="printfull" value="false"/>
</action>
<!-- The next action is for Continuous Integration testing -->
<action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore"/>
</actions>
</service>
</services>
Something like this:
//*[local-name()='jms-bus']
[#busid=//*[local-name()='jms-listener']
[#is-gateway='true']/#busidref]/#busid
or
//*[local-name()='jms-bus']
[#busid=//*[local-name()='jms-listener' and #is-gateway='true']/#busidref]/#busid

UrlRewriter.net Expression Examples

I need some web.config examples for each expression types below :
$number
The last substring matched by group number number.
$<name>
The last substring matched by group named name matched by (?< name > ).
${property}
The value of the property when the expression is evaluated.
${transform(value)}
The result of calling the transform on the specified value.
${map:value}
The result of mapping the specified value using the map. Replaced with empty string if no mapping exists.
${map:value|default}
The result of mapping the specified value using the map. Replaced with the default if no mapping exists.
Sample:
<rewriter>
<if url="/tags/(.+)" rewrite="/tagcloud.aspx?tag=$1" />
<!-- same thing as <rewrite url="/tags/(.+)" to="/tagcloud.aspx?tag=$1" /> -->
</rewriter>
Thank you very much !
Here's what I found/guessed. Not tested.
$number : http://urlrewriter.net/index.php/support/using
<rewrite url="^(.*)/(\?.+)?$" to="$1/default.aspx$2?" />
$1 matches (.*)
$2 matches (\?.+)
$< name > : this one I'm not so sure on the regex, couldn't find anything in documentation
<rewrite url="^(?<group1>(.*))/(\?.+)?$" to="$<group1>/default.aspx$2?" />
$<group1> matches
${property} : http://urlrewriter.net/index.php/support/reference/actions/set-property
<set property="branch" value="$3" />
<rewrite to="/showbranch.aspx?branch=${branch}" />
${transform(value)} : http://urlrewriter.net/index.php/support/reference/transforms
<set property="transform-name" value="lower" />
<set property="value-to-transform" value="THIS WAS UPPER CASE" />
<redirect to="/WebForm1.aspx?q=${encode(${${transform-name}(${value-to-transform})})}" />
results in "/WebForm1.aspx?q=this+was+upper+case"
${map:value} : http://urlrewriter.net/index.php/support/reference/transforms/static
<mapping name="areas">
<map from="sydney" to="1" />
<map from="melbourne" to="2" />
<map from="brisbane" to="3" />
</mapping>
<rewrite to="/area.aspx?area=${areas:$3}" />
results in "/area.aspx?area=brisbane"
${map:value|default}
<mapping name="areas">
<map from="sydney" to="1" />
<map from="melbourne" to="2" />
<map from="brisbane" to="3" />
</mapping>
<rewrite to="/area.aspx?area=${areas:$4|perth}" />
results in "/area.aspx?area=perth"

Resources