xpath-2.0

XPath search based on dynamic regular expressions

心已入冬 提交于 2019-12-10 10:39:37
问题 I have an XML like the one below: <?xml version="1.0" encoding="UTF-8"?> <Configuration> <Destinations> <Destination name="DEST1" > <From>AMA*</From> </Destination> <Destination name="DEST2" > <From>AMAZON</From> </Destination> <Destination name="DEST3" > <From>EBAY</From> </Destination> <Destination name="DEST4" > <From>*</From> </Destination> </Destinations> </Configuration> I want to query and find out all desintations that match a provided input. If i specify EBAY i want the xpath to

XPath: Match whole word (using matches function with case insensitive flag)

落爺英雄遲暮 提交于 2019-12-09 04:50:34
问题 Using XPath, I would like to "Match whole word" (option for user, just like in VS search). It seems as though the functions contains and matches work similarly though matches allows for flags like i for case insensitivity. In other words, I am getting the same results with these two XPath queries: <pets> <dog name="Rupert" color="grey"/> <dog name="Ralph" color="brown"/> <cat name="Marvin the Cat" color="white"/> <cat name="Garfield the Cat" color="orange"/> <cat name="Cat" color="grey"/>

How to find all numbers in a string

半城伤御伤魂 提交于 2019-12-08 04:16:27
问题 Ich versuche mit einer Funktion sämtliche Zahlen aus einem Element oder String zu ermitteln. Dabei soll die Anzahl der Zahlen und ihre Stelligkeit egal sein. Folgende Funktion habe ich bislang geschrieben: <xsl:function name="itp:find_num"> <xsl:param name="tmp"/> <xsl:if test="matches($tmp,'\d+')"> <xsl:analyze-string select="$tmp" regex="{'\d+'}"> <xsl:matching-substring> <xsl:sequence select="."/> </xsl:matching-substring> <xsl:non-matching-substring> <xsl:value-of select="''"/> </xsl:non

Ruby Selenium unable to select image from android image gallery

风格不统一 提交于 2019-12-08 04:03:50
问题 I am trying to select an image from Android image galley grid view. This grid view has ImageView for every image. Every ImageView has id. So when i am trying to get by //ImageView[@id="someId"][1] or by //GridView[@id="someId"]//ImageView[@id="someId"][1] , it does not find it. How can I select image from gallery using Selenium webdriver in ruby . EDIT: <GridView id = "someId"> <LinearView> <ImageView id = "someImageId"></ImageView> </LinearView> <LinearView> <ImageView id = "someImageId"><

XSLT2: How to reference attributes about the current node in XPath2 predicates

怎甘沉沦 提交于 2019-12-07 07:26:59
问题 I had posted another question with this as one aspect of it. I was told to clarify the question, but that question was already pretty long and complicated, so I created a new one. I want to know if there is standard way of referencing the current node's attribute in an XPath expression testing for another one. For an example, consider the following XSLT <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/

Ruby Selenium unable to select image from android image gallery

我只是一个虾纸丫 提交于 2019-12-06 21:02:26
I am trying to select an image from Android image galley grid view. This grid view has ImageView for every image. Every ImageView has id. So when i am trying to get by //ImageView[@id="someId"][1] or by //GridView[@id="someId"]//ImageView[@id="someId"][1] , it does not find it. How can I select image from gallery using Selenium webdriver in ruby . EDIT: <GridView id = "someId"> <LinearView> <ImageView id = "someImageId"></ImageView> </LinearView> <LinearView> <ImageView id = "someImageId"></ImageView> </LinearView> <LinearView> <ImageView id = "someImageId"></ImageView> </LinearView>

Shortest XPath to find minimum/maximum of sibling dateTime nodes

情到浓时终转凉″ 提交于 2019-12-06 13:45:02
问题 I have the following simple xml: <root> <item> <d>2002-05-30T09:00:00</d> </item> <item> <d>2005-05-30T09:00:00</d> </item> <item> <d>2003-05-30T09:00:00</d> </item> </root> Now I want to find the minimum or maximum dateTime node using XPath. My solution at the moment is: /root/item[not(number(translate(./d, 'TZ:-', '.')) <= number(translate(following-sibling::item, 'TZ:-', '.')))][not(number(translate(./d, 'TZ:-', '.')) <= number(translate(preceding-sibling::item, 'TZ:-', '.')))][1]/d It

XPath search based on dynamic regular expressions

北城以北 提交于 2019-12-06 04:37:10
I have an XML like the one below: <?xml version="1.0" encoding="UTF-8"?> <Configuration> <Destinations> <Destination name="DEST1" > <From>AMA*</From> </Destination> <Destination name="DEST2" > <From>AMAZON</From> </Destination> <Destination name="DEST3" > <From>EBAY</From> </Destination> <Destination name="DEST4" > <From>*</From> </Destination> </Destinations> </Configuration> I want to query and find out all desintations that match a provided input. If i specify EBAY i want the xpath to return the node name = DEST3 and DEST4 (which doesn't care about the value) but if i specify AMAZON it

XSLT2: How to reference attributes about the current node in XPath2 predicates

左心房为你撑大大i 提交于 2019-12-05 16:32:51
I had posted another question with this as one aspect of it. I was told to clarify the question, but that question was already pretty long and complicated, so I created a new one. I want to know if there is standard way of referencing the current node's attribute in an XPath expression testing for another one. For an example, consider the following XSLT <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:for-each select="potato/stem[eye]"> In session <xsl:value-of select="@sessionID"/>, the potato

XSL if test starts-with

梦想的初衷 提交于 2019-12-04 20:56:28
问题 Given this piece of XML <dc:date>info:eu-repo/date/embargoEnd/2013-06-12</dc:date> <dc:date>2012-07-04</dc:date> I should need with XSL to output only the year of the string not starting with info:eu-repo . I'm trying this way, but it doesn't work. I'm wrong with the for-each ? <xsl:if test="not(starts-with('dc:date', 'info:eu-repo'))"> <xsl:for-each select="dc:date"> <publicationYear> <xsl:variable name="date" select="."/> <xsl:value-of select="substring($date, 0, 5)"/> </publicationYear> <