How could I get the value of lang (where lang=eng in book title), for the first element?
Use:
/*/book[1]/title/@lang
This means:
Select the lang
attribute of the title element that is a child of the first book
child of the top element of the XML document.
To get just the string value of this attribute use the standard XPath function string()
:
string(/*/book[1]/title/@lang)
Related Posts:
- How to use XPath contains() here?
- XPath: Get parent node from child node
- How to parse XML in Bash?
- How do I comment out a block of tags in XML?
- What does
- Looking for a clear description of Excel’s .xlsx XML format
- Parse XML using JavaScript [duplicate]
- (Python) AttributeError: ‘NoneType’ object has no attribute ‘text’
- XSLT-FO for-each
- java.net.MalformedURLException: no protocol
- Meaning of –
- XSLT for each loop on simple XML
- AttributeError: ‘list’ object has no attribute ‘replace’ when trying to remove character
- Is XML a programming language?
- Convert XML to CSV file
- AttributeError: ‘list’ object has no attribute ‘replace’ when trying to remove character
- XML Parsing Error: not well-formed
- AttributeError: ‘list’ object has no attribute ‘replace’ when trying to remove character
- What is the difference between Inclusive and Exclusive OR?
- Manifest Merger failed with multiple errors in Android Studio
- Converting JSON to XML in Java
- xmlns, xmlns:xsi, xsi:schemaLocation, and targetNamespace?
- How can I escape “&” in XML?
- How to fix error: The markup in the document following the root element must be well-formed
- What’s “tools:context” in Android layout files?
- How to add a newline (line break) in XML file?
- Error -1072896636 “DTD Prohibited” when opening xml file in Excel, what do I do?
- How to define xsi:type as an attribute in XML-schema?
- What are invalid characters in XML
- How to implement if-else statement in XSLT?
- The ‘packages’ element is not declared
- understanding position() function in XSLT
- android.support.design.widget.CoordinatorLayout error
- YAML compared to XML
- URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs) in applicationContext.xml
- Import WordPress xml file larger than 8mb
- parse XML from URL (via SOAP)
- How can I bulk update all posts without making changes?
- Problems with creating hook that updates XML
- Features in Houzez are not loading in Backend from API
- WP All Import: Feeds of Feeds [closed]
- Is there an XML Web Service that can get posts, categories and other data from the site?
- Receive error exception using xampp with wordpress
- Work with xml file and WordPress
- Moving WordPress to a different directory – update XML Post File?
- WordPress importer / problem with images
- I need a standalone script in web root but still have access to the database
- stop duplicate post
- Importing feeds with PHP
- Create XML sitemap in wordpress
- How to make an xml file (just the xml file) available at a specific url?
- problem of path with xml file
- xml generator script wordpress [closed]
- How to pretty print XML from the command line?
- What does “xmlns” in XML mean?
- How to convert JSON to XML or XML to JSON?
- XPath //div[contains(text(), ‘string’)] fails to select divs containing ‘string’
- What characters do I need to escape in XML documents?
- “Content is not allowed in prolog” when parsing perfectly valid XML on GAE
- Text editor to open big (giant, huge, large) text files
- Converting XML to JSON using Python?
- How to convert an XML string to a dictionary?
- ‘xmlParseEntityRef: no name’ warnings while loading xml into a php file
- HTTP Status 500 Error instantiating servlet class
- No module named urllib3
- Is there a way to get element by XPath using JavaScript in Selenium WebDriver?
- Manifest Merger failed with multiple errors in Android Studio
- Python code to remove HTML tags from a string
- Http status 401 This request requires HTTP authentication (). in tomcat 6
- Android Studio 2.2.3: Gradle project sync failed. Basic functionality (e.g. editting, debugging) will not work properly
- In Java, how do I parse XML as a String instead of a file?
- How to add post featured image to RSS item tag?
- With WordPress Importer, why can’t I import post meta containing a multi-dimensional array, in which value(s) of that array contain line breaks?
- Localizing text from XML files
- How do I Import an RSS feed as WordPress posts without duplicates?
- $wpdb -> Batch insert from XML File?
- Search XML file from within WordPress?
- Failed to Open Stream: Permission Denied While Writing to an XML File in a WordPress Plugin
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Visual/Text Editor displays blank pages in WP-Admin- but HTML on client side displays correctly
- Display image from an external rss feed on wordpress without plugins
- A question on WXR
- How to import Theme Unit Test on localhost
- Rss error in first line of xml : not well-formed (invalid token)
- Import media (.xml) does not attribute featured images to posts
- Unlimited false pages showing in Sitemap?
- SimpleXML is not working with xml response from external api
- Import Instagram post as WordPress post
- WP All import sale price 0 [closed]
- XML file import for attachments or featured images
- Dynamically Create Posts Via XML File
- Prevent site down when importing data from large XML file
- accessing my mu-plugins from within a template file
- Pagination options using xml data instead of database?
- Moving 2 wordpress sites to one
- special XML to wordpress posts
- Create plugin/function to catch XML-data via Shortcode
- WordPress Feed Error [closed]
- Safe XML response from wordpress plugin
- How to create import option for xml