Hello guys I have an xslt file I want to extract data from.

I am new to xslt but at the moment I can perform basic operations like looping through the nodes and creating element and attributes.

My problem is that I want to select a particular value from a particular node(from a list of nodes), here is an example.






I want to get for example the name value say amanda if it matches the id. like in C# one would say: if (id==677) select name, Now I want the xslt equivalent.

6 Years
Discussion Span
Last Post by Mike Askew
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

  <xsl:template match="/">

  <xsl:template match="person">
    <xsl:if test="id = 677">
      <xsl:element name="Output">
        <xsl:value-of select="name"/>


As an example.

We would use the xsl:if to recreate the same if statement you demonstrated in c# :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.