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


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. 

** you can have only
one
direct precedent, and if it is <a> it can't be <br> or <li>.
Try this instead.
"br[not(preceding-sibling::node()[1][self::a] or
         preceding-sibling::node()[1][self::li])]"
 or, 
 "br[not(preceding-sibling::node()[1]
        [self::br or self::li or self::a])]**

What i think even in case of OR if suppose <br /> is after <li> and in
template match two conditions (not after <a> and <br> )are satisfied so
if i write
<xsl:template match=""br[not(preceding-sibling::node()[1][self::a] or
         preceding-sibling::node()[1][self::li])] or ....">
<br />
</xsl:template>
it will put a <br /> in output .
"if we think in logical Or's way even if a single condition is true it
will output true"
I think we should have something of type AND which gives true if all
conditions are true
and

 It would be better to do it the other way round and positively match
> these
> nodes:
> <xsl:template match=""br[preceding-sibling::node()[1][self::br or
> self::li
> or self::a]]">
> 	<!-- no br !! -->
> 	<xsl:apply-templates/>
> </xsl:template>
> 
> <xsl:template match="br">
> 	<br>
> 	<xsl:apply-templates/>
> 	</br>
> </xsl:template>

<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.
I hope you understand the problem.
and may be some of the things i have written look vauge to you so if i
am wrong please correct me
Thiabek









> > And if i want to tell that if <br /> has it's parent body  then do not
> > put <br /> in the output.
> > What should i write.
> 
> <xsl:template match="body/br">
> 	<!-- no br !! -->
> 	<xsl:apply-templates/>
> </xsl:template>
> 
> btw, people are less likely to answer your queries if your subject
> lines are
> very vague, 
> or histrionic.
> 
> cheers,
> Tom
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 

-- 
http://fastmail.fm/ - Consolidate POP email and Hotmail in one place

 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]