Subject: Re: [xsl] Resetting context to main document with "document()"? From: "Joerg Heinicke" <joerg.heinicke@xxxxxx> Date: Sat, 9 Mar 2002 00:08:49 +0100 |
That's really a big stylesheet with many document()'s. Can't you remove one or another template to see where the 'trash' comes from? Here an example: file1.xml <xml> <node name="a">123</node> <node name="b">456</node> <node name="c">789</node> </xml> file2.xml <xml> <nodes> <c/> <a/> </nodes> </xml> XSL <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:variable name="file1" select="/"/> <xsl:variable name="file2" select="document('file2.xml')"/> <xsl:template match="/"> <xsl:for-each select="$file2/xml/nodes/*"> <xsl:variable name="name" select="name()"/> <xsl:for-each select="$file1/xml"> <xsl:value-of select="node[@name=$name]"/> <xsl:text>,</xsl:text> </xsl:for-each> </xsl:for-each> </xsl:template> </xsl:stylesheet> Output: 789,123, No trash, only the expected output. Maybe this helps a bit. Joerg > Hi Joerg, > here is the stylesheet - in order to properly test it I would need to send > you also the xml files etc. If necessary, I can send the whole set. > The problem is that when I set the variable to "/", it outputs as an error > message words from the "templates" file (what I interpreted as trash...), > complaining "is not a valid URL". > Now I fixed it passing the same pathname twice to the xsl processor, once > as the name of the parsed file and once as a simple parameter. Not elegant, > isn't it? > Thank you very much, > Costantino > <xsl:variable name="doc" select="/"/> is THE one and in any case best > solution to handle this problem. That MSXML outputs trash is not standard, > it must come from your stylesheet. You can post your complete stylesheet > here and we will have a look at it. > > Regards, > > Joerg XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Resetting context to main, Costantino Sertorio | Thread | RE: [xsl] Problems with usage of XP, Bagchi Ratul |
[xsl] 𡁀 coming out as ?, Randy Belknap | Date | Re: [xsl] 𡁀 coming out as ?, Joerg Heinicke |
Month |