xpath

XPath: Nodes that have a child node that have an attribute

XML Fragment <component name='Stipulations'> <group name='NoStipulations' required='N'> <field name='StipulationType' required='N' /> <field name='StipulationValue' required='N' /> </group> </component> <component name='NestedParties3'> <group name='NoNested3PartyIDs' required=...

xpath query that selects only a tag with a given content length

Hello, I was wondering if it was possible to get a tag's contents only if has a given length (say, 300 characters) using XPath. Any help is welcome. Thanks in advance ...

GWT + XML documents with namespaces

I'd like to get a quick overview of available solutions (libraries, ...) that allow me to work with XML documents with namespaces on a DOM level - in GWT's client side. Additionally, I'm looking for an XPath solution that can work on that DOM (even if it requires writing my own XPath Navigator). XML parsing and serialization isn't nece...

XPath select tags by id not descendants of

I have the following code and I have to select all the nodes with id="text" but not the nodes that already have a parent with id="text": <fo:block id="text"> test00 <fo:block id="text"> test01 </fo:block> <fo:block> test02 </fo:block> </fo:block> <fo:block id="text"> test03 </fo:block> so in this example the ...

Given an XElement, how do I retrieve a reference to another relative XElement/Xattribute given an XPath?

Given the following XML: <SomeXML> <Element1> <Element2 Attribute3="Value4" /> </Element1 </SomeXML> ... and an XElement reference to 'SomeElement' and an XPath 'Element1/Element2/@Attribute3' How do I retrieve a reference to Attribute3 so that I may alter it's value (using the Xpath)? The XPath is to be a retrieved ...

How to pass an xpath into an xquery function declaration

Hi all, I use Apache Tomcat's Exist DB as an XML database and am trying to construct a sequence by passing the following xpath, defined in FLWOR's 'let' clause: $xpath := $root/second/third into a locally defined function declaration, like so: declare function local:someFunction($uuid as xs:string?, $xpath as xs:anyAtomicType?) { l...

XPath to convert child elements to single line list

I need XPath code to take child elements (one or more) and put them on a single line, separated by commas. So if I have the following XML: <Authors> <Author>Bob Smith</Author> <Author>Mary Jones</Author> <Author>Sam Doe</Author> </Authors> I want the following output: Bob Smith, Mary Jones, Sam Doe It needs to be smart enou...

php xpath problems

I'm doing a cURL POST and get the error response back, parse it into an array but having issues with xpath now. // XML <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <errors xmlns="http://host/project"&gt; <error code="30" description="[] is not a valid email address."/> <error code="12" description="id[] does not exist....

Express XPath as an expression tree

If I have an XPath query like NodeA/NodeB[@WIDTH and not(@WIDTH="20")] | NodeC[@WIDTH and not(@WIDTH="20")]/NodeD Is there any API available to visualize this XPath query as a stack of atomic expressions, something like (following is generic) Get results of NodeA, call it "first set" Get results of NodeB from "first set" Filter wher...

Filter a CSV list in XSLT

Hello SO; I'm trying to convert xml elements whose content is a csv list of identifiers, the exact form doesn't matter. I want to exclude every item that contains the character "/". The best I've come up with is translate(./someElement, ",*/*", "") but this has at least two problems; I'm pretty sure that xsl doesn't accept wildcards,...

Getting key/value pairs from plist-style xml using simplexml in php

Here is an example bit from the xml file: <array> <dict> <key>Name</key> <string>Joe Smith</string> <key>Type</key> <string>Profile</string> <key>Role</key> <string>User</string> <key>Some Number</key> <integer>1</integer> <key>Some Boolean</key> <true/>...

Trying to use an XSLT for an XML in ASP.NET

Hello, i have the following xslt sheet: <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:variable name="nhits" select="Answer[@nhits]"></xsl:variable> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <div> <xsl:call-template nam...

how to serially load widget in android application

I'm working on one application which uses widget approach. one HTML page is there which includes 6 widgets which will be added in the page at runtime. for each widget one xml and js file is there... when page start loading ... it's tries to load all the widget at same time .. and unable to load all the widget . like if there are ...

issue with a xmlns

Hello, I have an xml file and an xslt file. The xml file has a xmlns="exa:com.test" attribute. If i remove this attribute in the xml the xpath sentences in my xslt works. But if i leave it, doesnt work. Im using the following code to mix xml and xslt: XslCompiledTransform transformer = new XslCompiledTransform(); transformer.Load(...

How can I extract the desired nodes from this XML file using Perl and XPath?

After executing a XPath expression for extracting all year and value elements associated with death rates from a XML DB file, I want to take each node from the node list and find the year node, print that, find the value node, and print that all separately. The problem is that the output does not show anything. The XML content looks li...

How to select distinct values from XML document using XPATH?

How can I select only distinct elements for the XML document using XPATH?I've tried to use the 'distinct-values' function but it didn't work for some reason.. The XML is similar to the following: <catalog> <product> <size>12</size> <price>1000</price> <rating>1</rating> </product> <product> <size>10</size> <price>1000</price> <rating...

XSLT; parse escaped text to a node-set and extract subelements

Hello SO; I've been fighting with this problem all day and am just about at my wit's end. I have an XML file in which certain portions of data are stored as escaped text but are themselves well-formed XML. I want to convert the whole hierarchy in this text node to a node-set and extract the data therein. No combination of variables and...

Problem with using the XPATH functions

I've got a problem with using the XPATH functions. When I try to call some functions like lower-case or upper-case etc,they are not executed and I can't figure the problem out. I included the namespace xmlns:fn="http://www.w3.org/2005/xpath-functions" at the top of my XSL stylesheet and use fn namespace to call these functions but anyway...

Is this a valid XPath expression?

Is this xpath a valid XPath expression? (It does what it should ). #!/usr/bin/env perl use strict; use warnings; use 5.012; use XML::LibXML; my $string =<<EOS; <result> <cd> <artists> <artist class="1">Pumkinsingers</artist> <artist class="2">Max and Moritz</artist> </artists> <title>Hello, Hello</title>...

How can I use xsl stylesheet parameters to set a node name in XPATH expression?

I have the following XPATH expression: select="catalog/product/$category_name = $category_value" In the given example $category_name and $category_value are the XSL parameters that I receive from my servlet and I want to use them in XSL to filter the XML result based on category and its value.However, for some reason when,say, $catego...