- From: Tobias Reif <tobiasreif@pinkjuice.com>
- Date: Wed, 11 Jun 2003 17:27:09 +0200
- To: public-qt-comments@w3.org
Hi While working on XSLT apps, I need to inspect some variables and parameters. I need to get the type information and the positions in the sequence printed out (and possibly more info), not just the string value. I currently use <xsl:message> <xsl:copy-of select="trace($parent,'parent')"/> <xsl:copy-of select="trace($children,'children')"/> </xsl:message> (sometimes wrapped inside <xsl:if test="$debug"/>) => prints parent [1]: xs:string: span children [1]: xs:string: div children [2]: xs:string: p children [3]: xs:string: span children [4]: xs:string: span spandivpspanspan The above is useful, but in addition to what I want, I get the string value of the sequences (last line). The latter is not really useful in my case, and not needed. This <xsl:message> <xsl:copy-of select="$parent"/> <xsl:copy-of select="$children"/> </xsl:message> => prints span spandivpspanspan The above is way less informative, and not useful in my (and probably other) scenario(s). I guess I'd like to have something like this: <xsl:message> <xsl:inspect select="$parent"/> <xsl:inspect select="$children"/> </xsl:message> => would print parent [1]: xs:string: span children [1]: xs:string: div children [2]: xs:string: p children [3]: xs:string: span children [4]: xs:string: span xsl:inspect would simply return a string, and would not print anything by itself. This string can be stored in a variable, processed further, written to a run log, or simply printed out as in the above example. Some of my requirements: 1. I want to get information about a certain sequence at a certain point, which may not be the same point where I use it. 2. I need the information provided by trace(), but I want to decide on my own if I print this string or not. The function (eg a version of trace()) or element I want should not print anything, but only return a string. 3. I only want to see those values when I debug the XSLT. So I need to be able to enclose everything that prints out debug messages in <xsl:if test="$debug"/> 4. It should work in all conforming processors. I want a solution, not a workaround :) Tobi [the examples are run with Saxon 7.5.1] -- http://www.pinkjuice.com/
Received on Wednesday, 11 June 2003 11:27:25 UTC