[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] How to find the parent.
Subject: Re: [xsl] How to find the parent. From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Fri, 4 May 2001 16:34:30 +0100 |
Hi Pedro, > I would like to know if it is possible, once you have find a target > element (whatever kind of element is), to find out which is its > father. I always thought of elements as mothers ;) > A typical example would be looking for a substring and once find it > getting to know inside which element is included (paragraph, title, > ...). In fact, as the first query could produce a text-node result > set, but the actual question would be finding the result set of the > fathers. > > Example: > > query = in which elements the string " Shakespeare" is included. You'd probably be best off getting this by matching all those text nodes that include the string ' Shakespeare', and then getting their parent element. You can get the parent with the XPath: .. And then get its name with the name() function: <xsl:variable name="query" select="' Shakespeare'" /> <xsl:template match="text()"> <xsl:if test="contains(., $query)"> <xsl:text>Query string contained in:</xsl:text> <xsl:value-of select="name(..)" /> </xsl:if> </xsl:template> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] How to find the parent., Pedro Pastor | Thread | RE: [xsl] How to find the parent., Michael Kay |
[xsl] How to find the parent., Pedro Pastor | Date | Re: [xsl] SVG graphs, Larry_Mason |
Month |