Subject: [xsl] Selecting nodes whose text content contains a member of a Node-set... From: "Joel Beach" <joelbeach@xxxxxxxxxxxxxxxx> Date: 10 Sep 2001 09:05:52 EST |
Hi everyone.... Basically, I wante to implement a very basic form of partial string matching which I think should be possible in XSLT. Basically, I only want to select nodes from a node-set whose text content contains one member of another node-set. Can anyone help with this.... Basically, I am using Xalan, and passing a String as a parameter. I could then use Xalan's tokenize function to create a node-set containing all the "words" in the passed parameter. Now I want to check that one of the members of the "words" node-set is contained in the text node on which I'm basing selection. Am I right in understanding that there is no member() function....or is the position() function often used to fill this gap.... Or, coming from a more functional viewpoint, would I call contains() on the first element of the created node-set, drop the first element of the node-set, and then recursively continue until the contains() method succeeds, or the node-set of words is empty. Is it possible to remove a node from a node-set....should I just use <xsl:call-template name="foo" select="self::text()[ position() != 1 ]"/> to drop the first node? I have a skeleton working version of what I want to do here....this only works for exact string matches, hence the post. Basically, I want to replace the ( $trialNameConstraint = trialName ) part with what I descriebd above. Any ideas? <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="trialNameConstraint" select="'*'"/> <xsl:param name="sortOrder" select="'TrialName'"/> <xsl:template match="/"> <html> <body> <h1>Search Results</h1> <h2>Matching Results</h2> <xsl:apply-templates select="//Trial"> <xsl:sort select="descendant::node()[local-name() = $sortOrder]" order="descending" /> </xsl:apply-templates> </body> </html> </xsl:template> <xsl:template match="Trial"> <xsl:if test="( ( $trialNameConstraint = '*' ) or ( $trialNameConstraint = TrialName ) )"> <xsl:value-of select="TrialName"/> </xsl:if> </xsl:template> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Column Ordering Design Qu, Chris Bayes | Thread | RE: [xsl] Selecting nodes whose tex, Michael Kay |
[xsl] Column Ordering Design Questi, L Rutker | Date | Re: [xsl] pass value between xml an, Jennifer Hochgesang |
Month |