Subject: RE: [xsl] telling processor what to do From: TSchutzerWeissmann@xxxxxxxxxxxxxxxx Date: Wed, 21 Aug 2002 17:33:27 +0100 |
Hi Thiabek > I have already asked this few days before but did not get response to > this particular question as it was with another question. > I want to put a <br />tag in the output where ever it occurs in the > input but if they are just after <a> tag or <li>tag or <br > /> tag like > <a href="something">anchor</a><br/> or > <li>item 1</li> > <li>item 2</li> > <li>item 3</li><br />or > <br /> > <br /> > <br /> > I do not want to put them in output so i tried this > <xsl:template match="br[not(preceding-sibling::node()[1][self::br])] | > br[not(preceding-sibling::node()[1][self::a])] | > br[not(preceding-sibling::node()[1][self::li])]"> > <br/> > </xsl:template> > But it is not working.how should i write it. 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 - 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])] 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> > 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] telling processor what to do, abradoom | Thread | RE: [xsl] telling processor what to, abradoom |
Re: [xsl] 'interleaved' numbering, Jeni Tennison | Date | Re: [xsl] local variable problem..., Mike Brown |
Month |