outlier_lynn: (Default)
outlier_lynn ([personal profile] outlier_lynn) wrote2014-11-20 09:14 am
Entry tags:

xml, xslt, fo and ...

I work with xslt and formatting objects even though I really would rather chew off my own leg.

I'm working with xml that has a node "Person" which is a child of "Subject". "Person" has many children, two of which are "PersonName" and "PersionBirthDate".

There is another node called "PersonAlias". This node has two children: "PersonName" and "PersonBirthDate".

Looks something like this:
<subject>
 <person>
    <personname><personfullname>Outlier_Lynn</personfullname></personname>
    <personbirthdate>1949-06-27</personbirthdate>
 </person>
 <personalias>
    <personname></personname>
    <personbirthdate></personbirthdate>
 </personalias>
</subject>

I created a template that was suppose to create a string: "Alias(es): alias1, alias2, ..."
What I got was "Alias(es): alias1, ,Dob: dateAlias2, , Dob: date ..."

When I apply-templates select="PersonAlias", it gave me the dob even though I had not asked for it. Two hours later, I noticed that my PersonAlias template WAS NOT a match template, but, rather, an name template.

I learned something new. If a apply-templates does not find a corresponding match, it goes for the children of the node. And I have match templates for PersonName and PersonBirthDate.

Sigh.