XPath and XMLs with namespaces -


i have following xml:

<?xml version="1.0" encoding="utf-8"?> <arrayofagence xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"                xmlns:xsd="http://www.w3.org/2001/xmlschema"                xmlns="http://www.artos.co.il/">   <agence>     <codeaval>20008</codeaval>     <codesource>artpo</codesource>     <logicielsource>ntlis</logicielsource> </agence> </arrayofagence> 

i want codeaval value, tried:

arrayofagence/agence/codeaval 

it didn't work since xml has namespace, so, how need approach this?

thanks,

you mentioned in comment use xpath in xslt. in case need add namespace definition prefix input documents default namespace http://www.artos.co.il/ , use prefix in xpath expression.

example of namespace definition (it doesn't need in stylesheet element)

<xsl:stylesheet version="1.0"     xmlns:xsl="http://www.w3.org/1999/xsl/transform"     xmlns:artos="http://www.artos.co.il/"> 

example of prefix usage in xpath expression

<xsl:value-of select="artos:arrayofagence/artos:agence/artos:codeaval"/> 

note added prefix in front of every element name.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -