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

RE: Dumping a variable

Subject: RE: Dumping a variable
From: Marian Olteanu <mou_softwin@xxxxxxxxx>
Date: Sun, 5 Dec 2004 18:49:48 -0800 (PST)
asp variable dump
--- Michael Kay <mike@xxxxxxxxxxxx> wrote:

> > 
> > I have a variable, I'd like to dump the XML contained in that variable
> > without applying any parsing (debugging purposes).
> 
> I assume "dump" means "display" rather than "delete"?
> 
> What do you mean by saying that the variable contains XML? In XSLT 1.0 a
> variable can contain a node-set, or it can contain a string. In both cases
> you can display the value of the variable using 
> 
> <xsl:message><xsl:copy-of select="$var"/></xsl:message>
> 
> and no parsing will be involved. In fact, there is no way to invoke XML
> parsing from standard XSLT, so I don't understand your concern.
> 
> Michael Kay
> http://www.saxonica.com/
> 
Note that the result of xsl:message differs from implementation to implementation. For example,
MSXML silently discards your xsl:message that has no terminate="yes", so this solution would work
only if you use it like: 
<xsl:message terminate="yes"><xsl:copy-of select="$var"/></xsl:message>
This thing is stated at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/xmrefxslmessageelement.asp
:
<<Attributes
terminate 
Specifies whether the transformation should terminate upon executing this instruction. This
attribute can have one of two string values: "yes" or "no". When the terminate attribute is set to
"yes", the content of the element is displayed as the part of the system-level error message, and
the transformation terminates. When it is set to "no", the transformation proceeds, ignoring the
error message. The default value is "no". >>

Another solution: dump your variable in the output file (if you output XML, not text):
<variable-dump name="$var1"><xsl:copy-of select="$var1"/></variable-dump>
...
<variable-dump name="$var2"><xsl:copy-of select="$var2"/></variable-dump>

so later you can look into the output file and look for variable-dump elements.
I recomend you to use this method conditionally: set a parameter of your XSLT file (i.e.: debug)
and use like this:
<xsl:if test="$debug">
  <variable-dump name="$var1"><xsl:copy-of select="$var1"/></variable-dump>
</xsl:if>
This way, you can switch easily between debug mode and production mode.



=====
Marian
http://www.utdallas.edu/~mgo031000/


	
		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail

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.