xml - XSL parsing cannot access sub nodes when xmlns and other like attributes included -
thanks board assistance prior related post.
apologies sure basic questions regarding xml. newbie xml.
my xsl works if remove attributes datacontext node @ top of tree.
the minute add them node, xsl stops displaying values in output.
through bit of research see xmlns reserved attribute. have done bit of reading still don't quite understand why having result.
here xsl:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="/"> <html> <body> <h2>my text xsl</h2> <table border="1"> <tr> <th>attr9</th> </tr> <xsl:for-each select="/dcxt/atrs/atr"> <tr> <td><xsl:value-of select="@attr9"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> here xml names changed protect innocent.
specific issue in topmost node, dcxt node.
(carriage returns put in convenience, not exist in actual xml
<dcxt xmlns="http://www.xxxx.c0m" xmlns:xsi="http://www.w3.org/2001/xmlschema- instance" contactperson="xxxx" ourid="xxxx" version="xxxx" dbprefix="xxx" xsi:schemalocation="http://www.xxx.c0m/a/b/yyyy-dd filename_aa.bb.cc.xsd"> <desc>text description</desc> <dbc> <drv>text drv</drv> <prm/> <hsnode>text hsnode</hsnode> <ptnode>text ptnode</ptnode> <sname>text sname</sname> <prd/> </dbc> <dsps attr4="aaaa" attr5="1" attr3="bbb"> <dsp attr6="1" attr7="true" attr8="1"> <desc>text desc</desc> </dsp> <!--... multiple 'dsp' nodes defined defined ...--> </dsps> <atrs> <atr attr9="true" attr10="text attr"> <frs> <fr attr11="xxx" attr12="text attr"> <mps> <mp attr13="xxx" attr14="yyyy"/> <!-- .... multiple mp nodes defined --> </mps> </fr> <!--... multiple fr nodes defined ...--> </frs> <dpy> <rdfs> <sof attr15="xxx" attr16="0"/> </rdfs> <bfrs> <sof attr17="xxx" attr18="0"/> </bfrs> </dpy> </atr> <!-- multiple atr nodes defined --> </atrs> <!-- more nodes defined @ level removing brevity--> </dcxt>
Comments
Post a Comment