title: Get Specific Values from XML using XSLT
body: <p>I've been trying to get a value from a XML and create this output:</p>
  
  <pre><code>OUTPUT1=Question1=No&amp;Question2=Yes
  </code></pre>
  
  <p>My current output is:</p>
  
  <pre><code>    Question1=No
      Question2=Yes
  </code></pre>
  
  <p>I don't know the best approach to do this, I'm new to XSLT and I was thinking to store these values into a variable and use them later like:
  OUTPUT1=Variable1&amp;Variable2</p>
  
  <p>But even that it is a challenge to me, can someone help me with directions ?</p>
  
  <p>XSLT</p>
  
  <p>
      
      
      </p>
  
  <pre><code>&lt;xsl:template match="/"&gt;
      &lt;xsl:call-template name="processQuestion"&gt;
          &lt;xsl:with-param name="name" select="'ADM_1'"&gt;&lt;/xsl:with-param&gt;
      &lt;/xsl:call-template&gt;
      &lt;xsl:call-template name="processQuestion"&gt;
          &lt;xsl:with-param name="name" select="'ADM_2'"&gt;&lt;/xsl:with-param&gt;
      &lt;/xsl:call-template&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template name="processQuestion"&gt;
      &lt;xsl:param name="name"&gt;&lt;/xsl:param&gt;
      &lt;xsl:apply-templates select="//x:form/x:add[@name=$name]" mode="process" /&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="x:add" mode="process"&gt;
      &lt;xsl:value-of select="@title"/&gt;=&lt;xsl:value-of select="."/&gt;
      &lt;xsl:text&gt;&amp;#xa;&lt;/xsl:text&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p></p>
  
  <p>XML</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;
  &lt;transaction xmlns="TransactionDataOfRequest" xmlns:xsd="http://www.w3.org/2001/XMLSchema"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;success&gt;true&lt;/success&gt;
    &lt;code&gt;0&lt;/code&gt;
    &lt;value&gt;
      &lt;form&gt;
        &lt;add name="ADM_1" title="Question 1" type="String" isList="false"&gt;No&lt;/add&gt;
        &lt;add name="ADM_2" title="Question 2" type="String" isList="false"&gt;Yes&lt;/add&gt;
      &lt;/form&gt;
    &lt;/value&gt;
  &lt;/transaction&gt;
  </code></pre>
  
  <p>Variable</p>
  
  <pre><code>    &lt;xsl:variable name="test"&gt;
        &lt;xsl:value-of select="."/&gt;
      &lt;/xsl:variable&gt;
  </code></pre>
  
  <p>I've also tried this:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:x="TransactionDataOfRequest"&gt;
    &lt;xsl:output method="text" indent="no"/&gt;
    &lt;xsl:output omit-xml-declaration="yes" encoding="UTF-8"/&gt;
    &lt;xsl:strip-space elements="*"/&gt;
  
    &lt;xsl:template match="/"&gt;
      &lt;xsl:param name="param1" select="'ADM_1'"/&gt;
      &lt;xsl:param name="param2" select="'ADM_2'"/&gt;
  
      &lt;xsl:for-each select="//x:form/x:add"&gt;
        &lt;xsl:if test="@name=$param1"&gt;
  Question1=&lt;xsl:value-of select="."/&gt;
        &lt;/xsl:if&gt;
      &lt;/xsl:for-each&gt;
  
      &lt;xsl:for-each select="//x:form/x:add"&gt;
        &lt;xsl:if test="@name=$param2"&gt;
          &lt;xsl:variable name="test"&gt;
            &lt;xsl:value-of select="."/&gt;
          &lt;/xsl:variable&gt;
  Question2=&lt;xsl:copy-of select="$test" /&gt;
        &lt;/xsl:if&gt;
      &lt;/xsl:for-each&gt;
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>That was my first attempt, in fact I was able to save the value into a variable, but that variable only exist inside that template right?</p>