This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: telling processor what to do


Hi Thiabek

> Thanks Tom
> I would try to put meaningful and explainatory subject line.
> But there are few things which i want to discuss.as you said
>  
> **It's not working because you're matching the union of 3 nodesets
> where
> if a node isn't in one nodeset it must be all the others -**
> 
> I did not get what you  mean by that .
> if we have <br /> tag after so many tags like <br /> tag after <p> or
> <div> or <center> or <tr> or <font> or <input> etc
> then if i write
> <xsl:template match="p/br | div/br | center/br | tr/br | font/br> |
> input/br">
> <br />
> </xsl:template>
> Then what i think 
> It will do the template match and if it finds any <br /> which has
> parent 
> p or div or center or tr or font or input it will put a <br /> in
> output other wise not.
> So if in the input has only one <br /> that has say <input> as parent
> then in the template match it is not in any node set but
> input/br.therefore it does not mean it must be all others.
> as it is only in one nodeset input/br and not in any other nodeset.
> IT SHOULD BE ANY ONE IN THE GIVEN MATCH. that is what i 
> think. may be i
> am wrong. 

But that's exactly what I've been saying. A node matches one condition, and
only one. ie if a node is in nodeset A it isn't in nodeset B or C.

So, if you do the opposite, 

	template match="br[not parent::p] | br[not parent::div] | br[not
parent::center |
	br[not parent::font] | br[not parent::input]"

You will get all <br> nodes! A node will match one and only one condition,
but since
each nodeset is now defined as "nodes which *don't* meet a condition", then
any node
will *not meet* at least 4 out of your 5 conditions. 
[...]
> I think we should have something of type AND which gives true if all
> conditions are true

We do, the "and" operator. But you can write (not A and not B and not C) as
not(A or B or C), and sometimes it's easier. Don't confuse logical operators

like "and","or","not" with operators that work on nodesets, like the union
operator.

[...]

> <br /> tag is a self closing tag  as you can see.
> so i can not write <br> <xsl:apply-templates /> </br> in output.
> and as it do not contain any tag in it so no need to use
> apply-templates as it has no child elements.
Sure, but it doesn't make any difference. It's better to treat <br> nodes as
any other node, capable of having children even if your knowledge says they
never
will.

Cheers,
Tom

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]