on ‎2006 Aug 16 4:47 PM
Hi,
I need to get a substring from a xml document via xpath expression which has data. Can someone help.
Here's the data and what I want to do is via xpath expression return "20" only (1 thru 2nd position) of the BookingCode node.
Not sure how to substring via xpath expression.
Thanks for your help
<?xml version="1.0" encoding="UTF-8" ?>
<ns0:BookingOrders xmlns:ns0="urn:prueba:abap_mapping">
<Order>
<BookingCode>20Y34L</BookingCode>
<Passenger>
<Name>Smith</Name>
<Address>123 Main St.</Address>
</Passenger>
<Flight>
<Date>04042004</Date>
<AirlineID>SX</AirlineID>
<FlightNumber>21</FlightNumber>
<From>ZRH</From>
<To>FRA</To>
</Flight>
</Order>
</ns0:BookingOrders>This Xpath expression does not work
<b>/p1:BookingOrders/Order/BookingCode[(substring(.,2)]</b>
With the second operand = "20"
Request clarification before answering.
Normal usage for XPath function is
substring-before(<xpath>,arg1,arg2)
So usage would be something like
substring-before("/p1:BookingOrders/Order/BookingCode","Y")
But question wherein context are you calling this fucntion?
Assuming its an XSL mapping.. then u wud call this within <xsl:value-of select="...> stmt.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 12 | |
| 9 | |
| 6 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.