xslt - xml not showing in Browser -
below input xml :
<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl" href="value-of.xsl"?> <memeberdetails> <employee> <name>madhu</name> <sex>male</sex> <dob>2/10/1982</dob> <address>jp nagar ,bangalore</address> <memberid>094631</memberid> <designation>sse</designation> <department>sg</department> </employee> </memeberdetails>
where, referring value-of.xsl
file using href in above xml. , file residing in same folder.
below value-of.xslt file:
<?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> <xsl:output indent="yes"/> <xsl:template match="/"> <cgiemployeedetails> <personaldetails> <name> <xsl:value-of select="/memeberdetails/employee/name"/> </name> <gender> <xsl:value-of select="/memeberdetails/employee/sex"/> </gender> <residentialaddress> <xsl:value-of select="/memeberdetails/employee/address"/> </residentialaddress> </personaldetails> <workingdetails> <psaid> <xsl:value-of select="//memberid"/> </psaid> <designation> <xsl:value-of select="/memeberdetails/employee/designation"/> </designation> <department> <xsl:value-of select="/memeberdetails/employee/department"/> </department> </workingdetails> </cgiemployeedetails> </xsl:template> </xsl:stylesheet>
when run above xml in browser , output result text not xml . if use editor oxygen , transform same xml file , output xml.
i not getting why browser failing transform xml output ? there browser ?
in browsers, "xml format" view stylesheet adding syntax highlighting , emacscript event handlers (show , hide chlids nodes, etc.).
so, when document has xslt stylesheet pi, browsers don't run "xml format" stylesheet try render transformation result. intent not same each browser. 1 thing guaranteed: if it's proper xhtml or html, render is.
if transformation result not proper xhtml nor html (plain text, other xml vocabulary), render mechanism varies 1 another: i.e chrome 1 showing nothing unknown xml vocabulary, others render html anyway (rendering text).
Comments
Post a Comment