Skip navigation

Lost password? | Help

Fatal's Journal

August 2006

( Monthly archive )

XSLT quick tips

,

Originally posted by Mike Kay:

Eight tips for how to use XSLT efficiently:

  1. Keep the source documents small. If necessary split the document first.
  2. Keep the XSLT processor (and Java VM) loaded in memory between runs
  3. If you use the same stylesheet repeatedly, compile it first.
  4. If you use the same source document repeatedly, keep it in memory.
  5. If you perform the same transformation repeatedly, don't. Store the result instead.
  6. Keep the output document small. For example, if you're generating HTML, use CSS.
  7. Never validate the same source document more than once.
  8. Split complex transformations into several stages.

Eight tips for how to write efficient XSLT:
  1. Avoid repeated use of "//item".
  2. Don't evaluate the same node-set more than once; save it in a variable.
  3. Avoid <xsl:number> if you can. For example, by using position().
  4. Use <xsl:key>, for example to solve grouping problems.
  5. Avoid complex patterns in template rules. Instead, use <xsl:choose> within the rule.
  6. Be careful when using the preceding[-sibling] or following[-sibling] axes. This often indicates an algorithm with n-squared performance.
  7. Don't sort the same node-set more than once. If necessary, save it as a result tree fragment and access it using the node-set() extension function.
  8. To output the text value of a simple #PCDATA element, use <xsl:value-of> in preference to <xsl:apply-templates>.

This bunch of useful tips was found there.

Couple useful tips for widgets makers

, ,

I would like to expand first step of creating a widget:

1. Make a widget. This step may seem obvious, but the first and most important step is actually creating a working widget.

  1. Use standards
    Check if you widgets actually have valid HTML and CSS. There are no more excuses about crappy hacks for Internet Explorer.
  2. Use modern standards
    Check out standards that Opera already supports. Use modern standards like SVG, WebForms 2, HTML 5 (canvas), CSS 2.1 and 3 (selectors), XSLT, XPath, etc. It can make shorter development time and improve user experience.
  3. Check accesibility
    Create widget as it will be standard web page. Care about disabled people - provide alt attributes to images, use labels for form fields, check if your colors are contrast enough, etc.

P.S. Some useful examples how to use WebForms 2.
I will add to this post more tips as they come.
Download Opera, the fastest and most secure browser
August 2006
M T W T F S S
July 2006September 2006
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31