Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think that a good way to answer this question would to approach it from the other side. What practices make XSLT <em>ineffective</em>, and why?</p> <p>Some of the things that I've seen that result in ineffective XSLT:</p> <ol> <li><p><strong>Overuse of <code>for-each</code>.</strong> Everyone's said it; I'm saying it again. I find that <code>for-each</code> is often a sign of the developer trying to employ traditional programming techniques in a declarative language.</p></li> <li><p><strong>Underutilizing XPath.</strong> A lot of bad XSLT I've seen exists purely because the developer didn't understand predicates, axis specifiers, <code>position()</code>, and <code>current()</code>, and so he implemented logic using XSLT constructs instead.</p></li> <li><p><strong>Underutilizing metadata.</strong> You can sometimes eliminate an <em>enormous</em> amount of XSLT by providing your transform with metadata. </p></li> <li><p><strong>Underutilizing pre-processing.</strong> If, for instance, an XML document contains data that has to be parsed using XSLT string manipulation, it's often much simpler to do all of the parsing outside of XSLT and either add the parsed results to the XML or pass the parsed results as an argument to the transform. I've seen some remarkably unmaintainable XSLT implementing business logic that would be trivial to implement in C# or Python. </p></li> </ol> <p>The biggest problem that I'm running into in my own XSLT world (I have several 3,000+ line transforms that I'm maintaining) is dead code. I'm certain that there are templates in my transforms that will never be used again, because the conditions they're testing for will never arise again. There's no way to determine programmatically if something like <code>&lt;xsl:template match="SomeField[contains(., "some value")]&gt;</code> is alive or dead, because it's contingent on something that metadata can't tell you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload