Subject: RE: [xsl] Is there a way in xsl to point to a node if only a part of its name is known? From: Joshua.Kuswadi@xxxxxxxxxxxxxxxxxxxx Date: Thu, 22 Nov 2001 14:13:33 +1100 |
Michael wrote: > Is there a way in xsl to point to a node if only a part of its name is > known? >From what I know, there is no wildcard to partially match node names. The only thing close is select="*" which will select all elements. You could try using the XPath name() or local-name() function to return the node name as a string and then test if for what ever you need. > Sample xml 1: > <node1> > <node2> > <node3> > <tableName1.field1>content ...</tableName1.field1> > <tableName1.field2>content ...</tableName1.field2> > <tableName1.field3>content ...</tableName1.field3> > </node3> > </node2> > </node1> eg a template for the above XML sample (Note: This is untested, no guarantees ;-) <xsl:template match="node3"> <xsl:for-each select="*"> <!-- Should select the fieldname after the dot, '.', in the element name <xsl:variable name="fieldname" select="substring-after(local-name(), '.')" /> <xsl:if test="$fieldname = 'foo'"> <!-- Do stuff when element has 'foo' as the fieldname </xsl:if> </xsl:for-each> </xsl:template> HTH, Joshua ------------------------------------------------------------------------------ This message and any attachment is confidential and may be privileged or otherwise protected from disclosure. If you have received it by mistake please let us know by reply and then delete it from your system; you should not copy the message or disclose its contents to anyone. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Is there a way in xsl to , Michael Kay | Thread | [xsl] Re: Is there a way in xsl to , Dimitre Novatchev |
[xsl] Is there a way in xsl to poin, Michael Bauerfeld | Date | [xsl] Re: Is there a way in xsl to , Dimitre Novatchev |
Month |