xml - XSLT usage to reach attribute value in structured elements with the same name -
i hope can me problem found no solution @ moment. using xslt first time convert xml. trouble finding using template message element attribute value. btw i'm not generating xml , can't change structure
<?xml version="1.0" encoding="utf-8"?> <ns1:message > <ns1:notification> <ns22:message> <ns1:message value="timestamp"> </ns1:message> </ns22:message> </ns1:notification> </ns1:message>
assuming namespace declarations missing example have given, can access timestamp xslt looks this:
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:ns1="http://ns1.com/" xmlns:ns22="http://ns22.com/"> <xsl:template match="/"> <xsl:value-of select="/ns1:message/ns1:notification/ns22:message/ns1:message/@value"/> </xsl:template> </xsl:stylesheet>
i've made urls namespaces, general idea.
if xml document missing namespace declarations, it's not formed in case don't think there can it.
Comments
Post a Comment