[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Newbie - Trying to read in a value with XSL ...
Subject: RE: [xsl] Newbie - Trying to read in a value with XSL ... From: "Weakliem, Gordon" <Gordon.Weakliem@xxxxxxxxxxxxxxx> Date: Wed, 3 Jan 2001 13:30:55 -0700 |
Two problems: 1) select="/" won't select comment nodes. Try <xsl:for-each select="comment()" >. 2) Your code: Set root = source.documentElement Set newNode = source.createNode (8, "PAGE_FROM", "") newNode.nodevalue = "YES" root.appendChild(newNode) Appends the new node below root, i.e. <root><child/></root> becomes <root><child/><!--YES--></root> > When I try the node type of text, I get a concatenated list > of all values > (too many), with element I get nothing and with comment I get nothing. What's your context at the point you're doing the select? If your comment is a child of the current node, comment() will find it. In other words, given the simple document above, either of the following will work: <!-- example 1 --> <xsl:template match="root"> <tr> <xsl:for-each select="comment()" > <td> <xsl:value-of select="."/> </td> </xsl:for-each> </tr> </xsl:template> <!-- Example 2, I like this one better --> <xsl:template match="root"> <tr> <xsl:apply-templates select="comment()" /> </tr> </xsl:template> <xsl:template match="comment()"> <td> <xsl:value-of select="."/> </td> </xsl:template> OK, I've just spent way too much time on an MSXML 2.5 problem. The best solution is to tell your vendor to upgrade their product. > -----Original Message----- > From: Melissa Mussitsch [mailto:melissa.mussitsch@xxxxxxxxx] > Sent: Wednesday, January 03, 2001 10:03 AM > To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx' > Subject: [xsl] Newbie - Trying to read in a value with XSL ... > > > Hi, > I know very little about XSL and even XML for that matter. My company > purchased a product which uses the XSL functionality from the version > http://www.w3.org/TR/WD-xsl. > I need to make a modification and am having trouble. > Basically I'm trying > to pass a variable from my asp page to the XSL page, but > since I'm using > this older version, I can't utilize the xsl:param object (to > my knowledge). > I decided that I would create a new node on the asp side and > refer to that > node on the xsl side. > My code on the asp side is as follows: > > dim styleFile > styleFile = Server.MapPath("web_leads_survey.xsl") > > ' Load the XML > dim source > set source = Server.CreateObject("Microsoft.XMLDOM") > source.async = false > source.loadxml( sXML ) > > Set root = source.documentElement > 'I keep playing with different node types here trying to get > them to work > ... tried element, text, comment > Set newNode = source.createNode (8, "PAGE_FROM", "") > newNode.nodevalue = "YES" > root.appendChild(newNode) > > ' Load the XSL > dim style > set style = Server.CreateObject("Microsoft.XMLDOM") > style.async = false > style.load(styleFile) > > Response.Write(source.transformNode(style)) > > This is working properly - I get a node of name #comment with > value "YES". > My problem is referring to that node and value from XSL. The > code I tried > is below: > > <tr> > <xsl:for-each select="/" > > <td> > <xsl:value-of select="."/> > </td> > </xsl:for-each> > </tr> > > As you can see it's not much - but the pattern matching is > not working. > When I try the node type of text, I get a concatenated list > of all values > (too many), with element I get nothing and with comment I get nothing. > I tried using the <xsl:template match ...> which I've seen in > many examples > but this generates an error message, perhaps because of my version. > > Can anyone help - I've been working on this for a day and a > half and really > only have examples in internet doc searches to go on? > > Thanks > Melissa > melissa.mussitsch@xxxxxxxxx > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Newbie - Trying to read in a , Melissa Mussitsch | Thread | [xsl] position in a conditional for, James Piva |
[xsl] position in a conditional for, James Piva | Date | Re: [xsl] position in a conditional, Craig Pfeifer |
Month |