Subject: Re: [xsl] Correct way to test for no match From: Dan Vint <dvint@xxxxxxxxx> Date: Mon, 05 Oct 2009 18:33:37 -0400 |
unparsed-entity-uri(ancestor::ipb/figure/subfig/graphic[@boardno=$sht_num]/@boardno)
In this case I probably should have rearranged the when and otherwise tests and matched the good value and let the otherwise handled everything else. ultimately I also realized there was no value in doing this elaborate matching as the result is the same as the $sht_num.
Yes, exactly.
If $value is known to be 'x', then /path/to/node[@with=$value]/@with is always either
* 'x' (a @with node exists, and it has value 'x' by virtue of the '@with=$value' predicate on its parent in the path), or
* Nothing (no such node exists, has no value, coerced to '' when cast as a string)
That's effectively what you have with "ancestor::ipb/figure/subfig/graphic[@boardno=$sht_num]/@boardno".
(I leave aside the possibility that there may be multiple such nodes.)
I think you have two questions:
1. What is unparsed-entity-uri($sht_num)?
2. Is $sht_num referred to elsewhere in the document?
... and the code you are refactoring has conflated these.
This might sometimes be useful, if for example you are only interested in (1) if (2) is true. That is,
unparsed-entity-uri(ancestor::ipb/figure/subfig/graphic[@boardno=$sht_num]/@boardno)
will return a URI if (and only if) $sht_num appears as a @boardno on an ancestor::ipb/figure/subfig/graphic, and is also declared as an unparsed entity (with a URI not ''); otherwise it will be ''.
But you still need to keep the two questions clear in your head.
BTW, to refer to this as a "match" is somewhat confusing, since it's not a template match.
--------------------------------------------------------------------------- Danny Vint
Panoramic Photography http://www.dvint.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Correct way to test for n, Wendell Piez | Thread | Re: [xsl] Correct way to test for n, Wendell Piez |
RE: [xsl] Fwd: Is this a Saxon Bug , Michael Kay | Date | Re: [xsl] Fwd: Is this a Saxon Bug , David Carlisle |
Month |