Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: Xpath query to return "NULL" values? >Thread Next - Re: Xpath query to return "NULL" values? Re: Xpath query to return "NULL" values?To: NULL Date: 6/6/2009 12:03:00 PM Mario Splivalo wrote: > <itemList> > <item fieldName="name">Mario</item> > <item fieldName="age">29</item> > <item fieldName="height"></item> > </itemList> > > What I'm trying to get is a rowset or table, since I'm doing this from > postgres. So, my table would look like this: > > fieldName fieldValue > name Mario > age 29 > height NULL > > The idea was to have two XPath queries on the original XML. First one > ('/itemList/item/@fieldName') would extract all the attributes, and second > one would extract all the 'values' ('/itemList/item/text()'). Now I guess > I'll have to extract the nodes, as you've suggested, and then for each node > chech if it's empty or not. Are you using XPath inside of XSLT? There is no need to use foo/text() to get the string value of a 'foo' element, an element does have a string value of its own for instance with XSLT <xsl:value-of select="foo"/> would suffice. If you are using an XPath API then check how it allows you to extract the string value of a node. -- Martin Honnen http://msmvps.com/blogs/martin_honnen/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
