How to check if one string is a substring of another and print it out if true (XQuery/XML) -
in below code, $y returns 1 attribute value looks "ok hl dj fjj fj" etc. $l returns attribute values "ok" "hl". idea, want see if $l contained within $y, , if print out. third line of code past /country/ confused. not sure how include function past there described.
let $g := doc("cars.xml")/cars/honda[@id="hondacivic"] let $y := ($g/@type) $l in doc("cars.xml")/cars/country/[@car_code]???? return $y
the following tokenize whitespace-separated code string, , select country code in resulting sequence:
let $cars := doc('cars.xml')/cars let $type := $cars/honda[@id eq 'hondacivic']/@type let $codes := tokenize($type, '\s+') return $cars/country[@car_code = $codes]
usually idea use xml structure represent structured information, e.g. using repeatable type
element represent each of code independently instead of using string containing list of values.
Comments
Post a Comment