Re: [xsl] Match nodes searching for attributes in children

Subject: Re: [xsl] Match nodes searching for attributes in children
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Mon, 18 Jan 2010 03:11:02 +0100
On 18.01.2010 02:10, G. Ken Holman wrote:
You say "it didn't work" but you don't say how or why you think so. I
suspect you have something else wrong in your stylesheet.

Or in the data. "My template doesn't match" is a classic. Typical reasons include:
- not including the namespace prefix
- typo in the namespace URI
- processing the document in a different mode than the template is supposed to match in
- other typos (in predicates, element names, modes)
- skipping intermediate elements, e.g., formulating predicates for <td>s when the template is supposed to match <tr>
- other templates have higher priority
- this template is an imported one, and there is a matching template of whatever priority in the importing stylesheet
- logical misconceptions in the predicates (ok, this shouldn't apply here when just comparing an attribute value)
- if the template is supposed to match a result of a previous transformation: the output of the previous tranformation is not as expected
- ...

My way of debugging is
- to make the non-matching template increasingly less specific (dropping terms in the predicate),
- increase the priority to insane values,
- make the template output debugging info such as "I'm here", or count(*) and count(B) in the context of A (first make sure that the template matches A -- 'I'm A'),
- output intermediate processing steps to a file (<xsl:result-document href="_debug.35.fooify-bar.xml"><xsl:copy-of select="$foo"/></xsl:result-document>)

I'm sure that other people will contribute to this non-matching top ten or will share their debugging tricks, such as "always transform Schema-aware"...


Current Thread