Re: XSL Problems
"Leon Bezuidenhout" <[email protected]> Fri, 29 Dec 2006 14:34:19 +0200
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Message-ID | <[email protected]> |
Thank, I did not even notice that....
The thing is that the document is being constructed dynamically and to
create the node I do this:
var
var oNode = document.implementation.createDocument("","xsl:choose",
null).firstChild;
oNode.setAttribute("xmlns:xsl", "http://www.w3.org/1999/XSL/Transform");
Why are my nodes generated without the "xsl:" ? I know I am not setting the
namesoace in the proper manner, but this is the only way I have found that
displays the namespace in my XML.
I'm still new to Mozilla, I have been working with Explorer for the past 4
years, so please excuse the silly questions
Thanks
"Nickolay Ponomarev" <[email protected]> wrote in message
news:[email protected]...
> On 12/29/06, Leon Bezuidenhout <[email protected]> wrote:
>> [Exception... "Component returns failure code: 0x80600001
>> [nsIXSLTProcess.importStyleSheet]"
>> nsresult: "0x80600001 (<unkown>)" location: "JS frame ::
>> http://devmac1/csp/samples/wab/htmlcontrols/commonxml.js :: anonymous ::
>> line 49" data: no]
>>
> That's NS_ERROR_XSLT_PARSE_FAILURE (see
> http://silver.warwickcompsoc.co.uk/mozilla/misc/nserror). Did you
> check that your
> stylesheet is correct?
>
> It seems to me that you have a "<choose" element without a namespace.
>
> And iirc, you need a select="" attribute on <value-of/> (after putting
> that into right namespace too). I don't remember much about XSLT.
>
> Nickolay
>
>> My code looks as follows:
>>
>> var processor = new XSLTProcessor();
>> processor.importStylesheet(stylesheet);
>>
>> And my style sheet looks like htis:
>>
>> <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>> <xsl:template match="/">
>> <root>
>> <xsl:apply-templates select="/*/*"/>
>> </root>
>> </xsl:template>
>> <xsl:template match="*/*">
>> <Record>
>> <xsl:attribute name="RecordNo">
>> <xsl:value-of select="@rn"/>
>> </xsl:attribute>
>> <xsl:for-each id="foreach" select="node()">
>> <choose xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>> <when xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>> test=".[nodeName() = 'f1']">
>> <customerid>
>> <value-of
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
>> </customerid>
>> </when>
>> <when xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>> test=".[nodeName() = 'f2']">
>> <companyname>
>> <value-of
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
>> </companyname>
>> </when>
>> </choose>
>> </xsl:for-each>
>> </Record>
>> </xsl:template>
>> </xsl:transform>
>>
>> Thanks,
>> Leon
>>
>>
>> _______________________________________________
>> dev-tech-xml mailing list
>> [email protected]
>> https://lists.mozilla.org/listinfo/dev-tech-xml
>>