Jul 17 2006

XSLT Debugging in .NET 2.0

Category: XSLT, XPath, XMLBil@l @ 11:59

You can now debug an XSLT document in .NET 2.0.

You have now the XslCompiledTransform object that is used to do the transformation in .NET 2.0.

When you create your instance of the XslCompiledTransform use this constructor:

XslCompiledTransform xsl = new XslCompiledTranform(true);

Then, set a break point on the Tranform method call, when the debugger is there, hit F11 to enter the XSLT document and start debugging your Xslt file!

hth,

Regards

Tags:

Jun 18 2006

ToLowerCase or ToUpperCase in XSLT

Category: XSLT, XPath, XMLBil@l @ 20:35

This is a simple sample to show you how to transform the content of an element in an XML file from lower/upper case to upper/lower case

First of all define a variable of the element as:

    <xsl:variable name="Title">
      <xsl:call-template name="ToLowerCase">
        <xsl:with-param name="Field" select="Title"/>
      </xsl:call-template>
    </xsl:variable>

Then define the Template that will do the transformation:

  <xsl:template name="ToLowerCase">
    <xsl:param name="Field" select="''"/>
    <xsl:value-of select='translate($Field,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")'/>
  </xsl:template>

As you can see we are transforming all letters to lower case, the same can be done with a similar template to translate letters to upper case.

Hope this helps,

Regards

Tags: