The error string was a copy and paste from the error page. I don't think it's an error in my xslt, as if I change the it to call-template, it works. Anyway, here is the xslt.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" /> <xsl:template match="//Survey"> <xsl:for-each select="Question"> <xsl:sort select="ViewOrder" data-type="number" /> <xsl:value-of select="position()" />. <xsl:value-of select="@Label" /><br /> <xsl:apply-template name="TextQuestion" /> <!-- error occurs here --> </xsl:for-each> </xsl:template> <xsl:template match="TextQuestion"> <xsl:if test="@Multiline=0"> <input type="text" size="{@Columns}" name="{@QuestionID}" id="{@QuestionID}" /> <br /> </xsl:if> </xsl:template> </xsl:stylesheet> Erick ----- Original Message ----- From: "Weakliem, Gordon" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 16, 2002 3:49 PM Subject: Re: [DOTNET] Problem loading xslt > The XSLT element is <xsl:apply-templates />, so if your xslt contains > <xsl:apply-template />, the error message is correct, though not very > helpful in pointing out the real error. If this was just a typo in your > error message, then post the source of your xslt, the loading code isn't the > source of the error. > > > -----Original Message----- > > From: Erick Thompson [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, April 16, 2002 3:52 PM > > To: [EMAIL PROTECTED] > > Subject: [DOTNET] Problem loading xslt > > > > > > I'm writing an xslt template for html output. I'm using the > > XslTransform > > class, and loading the xslt from an embedded resource string. > > The error I'm > > getting is in the load function and is "'xsl:apply-template' > > cannot be a > > child of 'xsl:for-each' element". Now this doesn't make any > > sense to me, as > > I've used apply-template countless times under a for-each > > element. I usually > > use the MSXML COM objects for xslt transforms, but I'm trying > > to move a > > completely managed platform. Is this a restriction in xslt > > that only .net > > enforces? Or am I doing something wrong in my load function? > > > > _questionFormatter = new XslTransform(); > > Assembly thisAssembly = Assembly.GetExecutingAssembly(); > > Stream stream = > > thisAssembly.GetManifestResourceStream("NBR.WebSurvey.FormatQu > > estions.xslt") > > ; > > if (stream != null) { > > XmlReader reader = new XmlTextReader(stream); > > _questionFormatter.Load(reader); > > reader.Close(); > > stream.Close(); > > } > > > > Thanks, > > Erick > > > > You can read messages from the DOTNET archive, unsubscribe > > from DOTNET, or > > subscribe to other DevelopMentor lists at http://discuss.develop.com. > > > > > The information in this electronic mail message is sender's business > Confidential and may be legally privileged. It is intended solely for the > addressee(s). Access to this Internet electronic mail message by anyone > else is unauthorized. If you are not the intended recipient, any > disclosure, copying, distribution or any action taken or omitted to be taken > in reliance on it is prohibited and may be unlawful. > The sender believes that this E-mail and any attachments were free of any > virus, worm, Trojan horse, and/or malicious code when sent. This message and > its attachments could have been infected during transmission. By reading > the message and opening any attachments, the recipient accepts full > responsibility for taking protective and remedial action about viruses and > other defects. Galileo International is not liable for any loss or damage > arising in any way from this message or its attachments. > > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
