Kylix 2 Development in Portuguese!

I recently discovered that my book, Kylix 2 Development has been translated to the Portuguese language! You can purchase it here.

Thanks to Ronaldo Rezende Vilela Luiz for letting me know about this newest translation.

If you know about other translations, please let me know by adding a comment to this entry or sending me an e-mail to rick at rick dash ross dot com. Currently, Kylix 2 Development has been translated to German as well.

Posted in Uncategorized | Leave a comment

XSL and variables

I’ve been working with XSL lately, and been really impressed with the power of XSL and transformations. One thing I really like is how variables are declared within an XSL stylesheet.

For simple variables, the declaration looks like this:

   <xsl:variable name=”aVariable” select=”‘someValue'”/>

Variable declarations do not stop there. What I really like is how complex variable declarations encapsulate the logic to assign their value. Consider the following example:

   <xsl:variable name=”aComplexExample”>
      <xsl:choose>
         <xsl:when test=”blah = blahblah”>
            first value
         </xsl:when>
         <xsl:when test=”blah2 = blahblahblah”>
            second value
         </xsl:when>
         <xsl:otherwise>
            default value
         </xsl:otherwise>
      </xsl:choose>
   </xsl:variable>

Notice how the variable declaration wraps the logic in one nice package. Really nice.

However, there is one caveat with variables. They cannot be changed once they are assigned. So, if you want to increment a counter, you’re out of luck. In my case, I was fortunate enough that I could change the XML file definition so I could get the desired results. So really the name variable should be constant instead.

One last thought. When you have control of the layout with XML and XSL files, work backwards by creating the desired output first, changing the XML format as necessary.

Posted in Uncategorized | Leave a comment