Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

How to debug XSLT-based generators
xomega
#1 Posted : Thursday, November 1, 2012 6:50:53 PM(UTC)
xomega



Xomega generators are based on XSLT 2.0, which is a significant improvement over the initial XSLT 1.0 specification. It provides numerous additional functions as part of XPath 2.0 as well as ability to define your own functions, supports XQuery syntax and multiple enhancements to the XSLT syntax as well.

Unfortunately, Microsoft .Net platform does not support XSLT 2.0, and Xomega utilizes Saxon .Net XSLT transformation engine. There is no way to set breakpoints or step through the XSLT script for your generator, but you can output any logging information including the values of any variables and also run the generator as soon as you make any changes without having to compile it, which helps tremendously during development of the script for the generator.

Here are the steps you can take that will help you debug your generator. Note, that they require the Full edition of Xomega.Net as well as availability of the source code for the generators. If you install an evaluation version of the Full edition, then you can use a generator that comes with the source code in the evaluation version, e.g. the DB Lookup Cache Loaders from the Static Data folder.
  1. Select the generator that you want to debug from your project, and press F7 to view its source.
  2. If you want to debug a script that your generator imports, then place the cursor on the script file name in the corresponding xsl:import tag and select Go To Definition or press F12 to navigate to the source code of that script.
  3. To insert a static log message anywhere in the script file use the xsl:message tag as follows.
    Code:
    <xsl:message>This is a static message.</xsl:message>

  4. To output the value of any variable in the script use the xsl:message tag with a select attribute as follows.
    Code:
    <xsl:message select="$files"/>

  5. If you want to output the value for only a certain element, or based on any other condition, you can wrap your message in the standard XSLT xsl:if element as follows.
    Code:
    <xsl:if test="$OutputPath">
      <xsl:message select="$file>
    </xsl:if>

  6. Run the generator and look in the Output window in Visual Studio to view the log messages.
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.