[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Newbie - Trying to read in a value with XSL ...

Subject: RE: Newbie - Trying to read in a value with XSL ...
From: "Weakliem, Gordon" <Gordon.Weakliem@xxxxxxxxxxxxxxx>
Date: Wed, 3 Jan 2001 13:30:55 -0700
xsl select comment
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:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.