Re: [xsl] Implementing simple XLinks using XSL

Subject: Re: [xsl] Implementing simple XLinks using XSL
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Sat, 23 Dec 2000 19:01:58 +0000
Adam,

> This line:
> <xsl:template match="*[@xlink:show='embed'][@xlink:actuate='onLoad']">
> seems to not be picking up the correct elements. I tested it by writing out
> <foo>bar</foo> or something just to make sure that had the correct match
> pattern. Unfortunately nothing worked. Can someone verify that I have the
> correct match, or select a better one. I'm trying to avoid using a
> <for-each> loop if I can. 

The XPath:

 *[@xlink:show='embed'][@xlink:actuate='onLoad']

matches all that have a 'xlink:show' attribute with a value of 'embed'
and a 'xlink:actuate' attribute with a value of 'onLoad'.  I'm afraid
I've lost your original message, but I think that the element name
that you were interested in was xlink:simple - if that's the only
element name, you could use:

  xlink:simple[@xlink:show='embed'][@xlink:actuate='onLoad']

instead.  You could also combine the two predicates if you wanted:

  xlink:simple[@xlink:show='embed' and @xlink:actuate='onLoad']

That *should* match against an element that looks like:

  <xlink:simple xlink:show="embed" xlink:actuate="onLoad" />

If it doesn't, then you might be having a namespace problem: have you
defined the 'xlink' namespace in the same way in your source and your
stylesheet?

To debug, I'd get rid of the predicates and make sure that the element
you're after is matched then. If it's not matching, are you applying
templates to the element you're after? If it is matching, there might
be problems testing the values of the attributes if the values have
leading/trailing whitespace, different capitalisation and so on, so
check that that's the same.  If none of those help, try posting the
source here and see if someone else's eyes can spot the problem.

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread