on 08-16-2006 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"
Hi Luis,
it is
substring(//Order/BookingCode,1,2)
Regards,
Udo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check this blog:
/people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination
You can do your request similar.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.