I know that's a .Net forum, but some Xml please...

  • Thread starter Thread starter Eduardo Rosa
  • Start date Start date
E

Eduardo Rosa

I've a trouble with xml, I need to access "a node with child that had some
specific text". Somebody can help me?

Thanks a lot

example:

xsl file:
<xsl:template match="Group[@Name='artigos']"> <!-- that`s works-->
<xsl:apply-templates select="Item"></xsl:apply-templates>
</xsl:template>

<xsl:template match="expression"> <!-- that template need to get the node
indicate in the xml below-->
<tr>
<td>
<!-- Do something very complicated, usefull and coll -->
</td>
</tr>
</xsl:template>

xml file:

<Group Name="artigos">
<Item> <!-- the template need to get that "Item"
because Item/Info[8] = 'baseA' -->
<Info>1</Info>
<Info>1</Info>
<Info>0</Info>
<Info>Pagina com box</Info>
<Info>23/11/2004</Info>
<Info>A lot of text<Info/>
<Info/>
<Info>Home</Info>
<Info>baseA</Info>
</Item>
<Item>
<Info>1</Info>
<Info>1</Info>
<Info>0</Info>
<Info>Pagina com box</Info>
<Info>23/11/2004</Info>
<Info>A lot of text<Info/>
<Info/>
<Info>Home</Info>
<Info>baseB</Info>
</Item>
</Group>
 
The XPath for that would look something like:

//*[./text() = 'some specific text']

But if your node needs to be more specific, then:

//TheSpecificNodeName[./text() = 'some specific text']

You can download a great XML book called "Essential XML Quick Reference"
from DevelopMentor's website (click on the blue "d" circle to download):

http://www.develop.com/us/technology/developmentorseries.aspx

I use this any and every time I need to do some XSLT, XPath or XSD work.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
Back
Top