title: Correct way of writing xsl:value-of in XSLT
body: <p>I am trying to write XSLT to transform my XML from one format to another. When I apply my <code>.xslt</code> file to the XML file in VS 2010, <strong>the output XML structure is created without any problem. But it does not fill in data expected by processing <code>xsl:value-of</code>.</strong> </p>
  
  <p>When I use <code>XMLSpy</code> and evaluate the <code>XPath</code> expression, it says <code>no result</code> for the expressions in following XSLT. But when I use <code>node()</code> function at the end of the XPath expression, it shows the value! </p>
  
  <ol>
  <li>What is the correct way of writing XPath?</li>
  <li>Does <code>node()</code> and <code>text()</code> kind of functions really necessary everytime to read the element content (when it has no child elements) ? If no, why XmlSpy too does not give result without those functions?</li>
  <li>Sometimes (when i change the template match value from "/" to the "ServiceMessage" ) while debugging XSLT, VS 2010 steps into built in template rules. Why is it so? How can I get rid of built in templates in VS 2010?</li>
  </ol>
  
  <p>I have followed <a href="http://www.w3schools.com/xsl/xsl_value_of.asp" rel="nofollow">w3school tutorial</a> to begin with. I am new to XSLT. </p>
  
  <p>Here is my XML which I want to transform to some other XML format.</p>
  
  <pre><code>&lt;ServiceMessage xmlns="http://requestservice/requests" xmlns:req="http://requestservice/requests/xmlstds"&gt;
  
  &lt;TypeOfReq&gt; General &lt;/TypeOfReq&gt;
  &lt;Details&gt;
     &lt;Id&gt; 123456789 &lt;/Id&gt;
     &lt;SenderDetails&gt;
          &lt;Sender id="345"&gt;&lt;/Sender&gt;
     &lt;/SenderDetails&gt;
  &lt;/Details&gt;
  
  &lt;/ServiceMessage&gt;
  </code></pre>
  
  <p><strong>This is my XSLT</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" &gt;
    &lt;xsl:output method="xml" indent="yes"/&gt;
    &lt;xsl:template match="/"&gt;
      &lt;request&gt;
        &lt;requestType&gt;
          &lt;xsl:value-of select="ServiceMessage/TypeOfReq" /&gt;
        &lt;/requestType&gt;
        &lt;Id&gt;
          &lt;xsl:value-of select="ServiceMessage/Details/Id"/&gt;
        &lt;/Id&gt;
        &lt;senderId&gt;
          &lt;xsl:value-of select="ServiceMessage/Details/SenderDetails/Sender/@id"/&gt;
        &lt;/senderId&gt;
      &lt;/request&gt;
  
    &lt;/xsl:template&gt;
  
  
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>