You could use the XSLT engine embedded in most of the browser.
This shows examples for IE and FF:
http://www.w3schools.com/xml/xml_examples.asp
And those are geared towards FF:
http://developer.mozilla.org/en/docs...ransformations
http://developer.mozilla.org/en/docs/XSLT
http://www.topxml.com/xsl/tutorials/intro/
You could create a simple XSL stylesheet and by associating this with your XML document, it will output the content of the Sample_Tag as html.
I suggest XSLT, as this gives you more flexibility that pure JS scripting, if the content of your Sample_Tag change.
In your case, you will need to do a fragment transformation.
You get a basic example on that page of the mozilla wiki.
http://developer.mozilla.org/en/docs...:Basic_Example
This processe have 1 disadvantage though.
As far as I know, Safari don't have access to any XSLT engine, except if the webkit development package is installed on the mac.
Except for safari, this should work in firefox/ie6/ie7 and opera without a glitch.
Or you could make the transformation on the server and serve back html directly. The procedure should be fairly equivalent.
You can play with xml+xsl directly in your browser, if you want to test it.
I created this XML document from your exemple
1.xml:
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xml" href="1.xsl"?>
<root>
<Sample_Tag>
<ul>
<li>List 1</li>
<li>List 2</li>
</ul>
</Sample_Tag>
<Sample_Tag>
<ul>
<li>List 1.1</li>
<li>List 1.2</li>
</ul>
</Sample_Tag>
<Sample_Tag>
<ul>
<li>List 2.1</li>
<li>List 2.2</li>
</ul>
</Sample_Tag>
</root>
And this xsl stylesheet 1.xsl (if you change the names, change the reference to the stylesheet in the xml file too):
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="iso-8859-1" indent="yes"/>
<xsl:template match="/root">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match="Sample_Tag">
This is a sample tag
<ul>
<xsl:for-each select="ul/li">
<li><xsl:value-of select="."/></li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template match="ul">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
Put the 2 files in the same directory, and try to open teh xml document in your browser.
It's magic!