xpath-2.0

Concatenate values of elements to a variable with the usage of a template?

倖福魔咒の 提交于 2019-12-13 07:37:56
问题 The following data need to be concatenated. But the XML document which I received can have "zero to n" b elements. In other words if there are no b elements the xslt should still work correctly example: <a> <b1>Some</b2> <b2>data</b2> <b3>what</b3> <b4>need</b4> <b5>to</b5> <b6>be</b6> <b7>concatenated</b7> </a> Expected result <a> <b1>Some data what need to be concatenated</b1> </a> I was trying the following construction but I couldn't made it work. <xsl:variable name="details" select="//b*

Xpath2.0 selecting first and last occurance of string with iteration

早过忘川 提交于 2019-12-13 07:34:11
问题 I have this tree: <Events> <Properties> <Property Descriptor=100>1378314022</Property> <Property Descriptor=200>ABC1234</Property> </Properties> <Properties> <Property Descriptor=100>1378314023</Property> <Property Descriptor=200>ABC1234</Property> </Properties> <Properties> <Property Descriptor=100>1378314024</Property> <Property Descriptor=200>ABC1234</Property> </Properties> <Properties> <Property Descriptor=100>1378314022</Property> <Property Descriptor=200>123456</Property> </Properties>

xpath accessing information in nodes

穿精又带淫゛_ 提交于 2019-12-13 03:04:17
问题 i need to scrap information form a website contain the property details. <div class="inner"> <div class="col"> <h2><a href="house-in-digana-for-sale-kandy-32">House in Digana </a></h2> <div class="meta"> <div class="date"></div> <span class="category">Houses</span>, <span class="location">Kandy</span> </div> </div> <div class="attr polar"> <span class="data">Rs. 3,600,000</span> </div> what is the xpath notation for "Kandy" and "Rs. 3,600,000" ? 回答1: It is not wise to address text nodes

XPath and min function not recognized in xslt

两盒软妹~` 提交于 2019-12-12 04:44:42
问题 <td class="num"> <xsl:if test="min(//vrednostDelnice)=trgovalniPodatki/vrednostDelnice"> <xsl:attribute name="class">red</xsl:attribute> </xsl:if> <xsl:if test="max(//vrednostDelnice)=trgovalniPodatki/vrednostDelnice"> <xsl:attribute name="class">green</xsl:attribute> </xsl:if> <xsl:value-of select="format-number(trgovalniPodatki/vrednostDelnice, '#.###,00 €', 'euro')"/> </td> but I get This document had an invalid XSLT stylesheet. Error message from the XSLT engine: Error: XPath expression

NULL literal in XPath

戏子无情 提交于 2019-12-11 18:59:47
问题 Is there a NULL literal in XPath 1.0 or 2.0? My use case is that I have a conditional ( if then else ) XPath expression and I want to return NULL to signify a certain condition. I am afraid that returning an empty string might be ambiguous in my case as it could be a valid result of the other part of the if then else expression. 回答1: The empty sequence () can be used as such. It is also returned if there is no result for a path expression. let $foo := "foo" return if ($foo = ("foo", "bar",

In XPath, how can I select groups of following-sibling nodes before and after an anchor element?

我的梦境 提交于 2019-12-11 11:12:55
问题 I have a xml document like follows, <sec> <p type="Running">aa</p> <p type="heading 1">bb</p> <p type="body">cc</p> <p type="body">dd</p> <p type="Running">ee</p> <p type="Body">ff</p> <p type="heading">gg</p> <p type="body">hh</p> <p type="body">ii</p> <p type="Running">jj</p> <p type="list">kk</p> <p type="list">ll</p> <p type="list">mm</p> <p type="list">nn</p> </sec> using xpath I need to select consecutive following-siblings of <p> nodes from <p> that has attr value of Running . SO in

Xpath matches againt items

≡放荡痞女 提交于 2019-12-11 05:07:52
问题 The matches function acts against a string (where the result is a single item of type string). Looking for a way with XPath to do the same regular expression matches but against items (result is a sequence of nodes/items)? 回答1: //foo/bar[matches( ., 'regexp' )] Is this what you're looking for or am I misunderstanding your question. This filters the //foo/bar nodelist based on the string value of every node. (The string value of elements is the concatenation of all the text nodes within it.)

Output values in a certain way using XSLT/XPath 2.0

隐身守侯 提交于 2019-12-11 03:16:57
问题 I have an XML like this: <?xml version="1.0" encoding="UTF-8"?> <Section> <Chapter> <Cell colname="1"> <Value>A</Value> </Cell> <Cell colname="2"> <MyValue>AAA</MyValue> <MyValue>BBB</MyValue> </Cell> <Cell colname="3"> <MyCar>Honda</MyCar> </Cell> </Chapter> <Chapter> <Cell colname="1"> <Value>C</Value> </Cell> <Cell colname="2"> <MyValue>CCC</MyValue> </Cell> <Cell colname="3"> <MyCar>Toyota</MyCar> </Cell> </Chapter> </Section> I like the have a message (later on convert them tags) output

How to use XPath to select Cartesian Product set of non null sibling nodes?

懵懂的女人 提交于 2019-12-10 23:29:21
问题 First time poster here, so please don't hesitate to let me know if I've done something wrong. I'm using Altova Stylevision to print out form documents, and I need to print a copy of the form for each unique set of two node collections. Below is a sample XML to better explain what I'm asking for. <form> <Animals> <Animal> <AName>Boomer</AName> <AAddress>House</AAddress> </Animal> <Animal> <AName>Growl</AName> <AAddress>Street</AAddress> </Animal> <Animal> <AName>Incognito</AName> <AAddress

Converting and HL7 segment to XML

非 Y 不嫁゛ 提交于 2019-12-10 19:56:28
问题 i have an XML that we were able to generate using HAPI libraries and use XSL to change the format of the XML. I am using the following template. The current template looks at the OBX.5 segment for a digital value and then interprets the OBX6 (units of measure). However I am trying to also interpret the OBX6 when they come from one of the clients in a style as duplicates with the caret ^ in between (ex: %^% or mL^mL ). My current template ignores this but I would like to be able to get the