Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Recursion within documentElement.transformNode ???

From: Jack Maclean <litewoheat@-----.--->
To: NULL
Date: 9/9/2009 11:05:00 PM
Hello,

I'm kinda new to XSLT but not a beginner. I have a chunk of XML that
holds recursive data. Here's a simple sample:


<thread>

	<threadentry id="1760434" img="a.jpg" text="Start New Thread">


		<threadentry id="1760440" img="a.jpg" text="First Reply">
		</threadentry>

		<threadentry id="1760445" img="b.jpg" text="Second Reply">

			<threadentry id="1760440" img="c.jpg" text="Reply to the reply.">
			</threadentry>

		</treadentry>

	</threadentry>

</thread>


I'm trying to use the documentElement.transform node method to convert
this using XSLT into DHTML.  I've been reading various articles on
recursion in XLST but they all use templates and when I try to use
templates per the samples IE complains. I just can't figure out how to
do this. Totally stuck.   Can anyone help?


--------------------

the JavaScript snippet:


	gXSL = new ActiveXObject("Microsoft.XMLDOM");
	gXSL.async="false";
	gXSL.load("threads.xsl");

	gThreadsXML = new ActiveXObject("Microsoft.XMLDOM");
	gThreadsXML.async = "false";
	gThreadsXML.loadXML(gThreadsXMLStr);

	if (gThreadsXML.parseError.errorCode != 0) return;

	f_ThreadContainer.innerHTML =
gThreadsXML.documentElement.transformNode(gXSL.documentElement);



------------------------

the simplest XSL that I can get to work looks like this. Its not doing
what I want, it just outputs the root elements, no child elements.


<div xmlns:xsl="http://www.w3.org/TR/WD-xsl">

	<TABLE BORDER="0" CELLSPACING="0" cellpadding="2">

		<xsl:for-each select="threadentry">
			<TR class="stateHeader">
				<TD>
					<xsl:value-of select="@id"/>
				</TD>

				<TD>
					<xsl:value-of select="@img"/>
				</TD>

				<TD>
					<xsl:value-of select="@text"/>
				</TD>
			</TR>

		</xsl:for-each>

	</TABLE>
</div>






transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent