How can I select a specific node with an unique ID and return the entire node as xml.
<xml>
<library>
<book id='1'>
<title>firstTitle</title>
<author>firstAuthor</author>
</book>
<book id='2'>
<title>secondTitle</title>
<author>secondAuthor</author>
</book>
<book id='3'>
<title>thirdTitle</title>
<author>thirdAuthor</author>
</book>
</library>
</xml>
In this case I would like to return book with id='3', so it will look something like this:
<book id='3'>
<title>thirdTitle</title>
<author>thirdAuthor</author>
</book>
XSLT generate-id() Function The generate-id() function returns a string value that uniquely identifies a specified node. If the node-set specified is empty, an empty string is returned. If you omit the node-set parameter, it defaults to the current node.
XSLT doesn't have any new function to search Strings in a reverse manner. We have substring function which creates two fields substring-before-last and substring-after-last.In XSLT it is defined as follows: <xsl:value-of select="substring (string name ,0, MAX_LENGTH )"/>...
Definition and Usage. The <xsl:number> element is used to determine the integer position of the current node in the source. It is also used to format a number.
If you are referring to XPath (because you are searching in the document, not transforming it), that would be:
//book[@id=3]
Of course, depending on your language, there might be a library that makes this search even simpler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With