<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss">

<channel>
	<title>www.netsi.dk &#187; //</title>
	<atom:link href="http://www.netsi.dk/wordpress/index.php" rel="self" type="application/rss+xml" />
	<link>http://www.netsi.dk/wordpress</link>
	<description>&#34;The internet is just a layer on the real world&#34; (don&#039;t forget that!)</description>
	<lastBuildDate>Fri, 27 Jan 2012 15:57:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<atom:link rel="next" href="http://www.netsi.dk/wordpress/index.php?page=2" />

		<item>
		<title>Using XPath operator &#8220;//&#8221; aka &#8220;descendant-or-self&#8221; in XSLT</title>
		<link>http://www.netsi.dk/wordpress/index.php/2010/06/08/using-xpath-operator-aka-descendant-or-self-in-xslt/</link>
		<comments>http://www.netsi.dk/wordpress/index.php/2010/06/08/using-xpath-operator-aka-descendant-or-self-in-xslt/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 20:36:58 +0000</pubDate>
		<dc:creator>netsi</dc:creator>
				<category><![CDATA[XSLT]]></category>
		<category><![CDATA[//]]></category>
		<category><![CDATA[descendant-or-self]]></category>
		<category><![CDATA[operator]]></category>
		<category><![CDATA[XPath]]></category>
		<category><![CDATA[xslt]]></category>

		<guid isPermaLink="false">http://www.netsi.dk/wordpress/index.php/2010/06/08/using-xpath-operator-aka-descendant-or-self-in-xslt/</guid>
		<description><![CDATA[In my daily work as frontend developer at www.bleau.dk I do a lot of XSLT “programming” – XPath is one of the things you need to master most. With the focus mainly set on closing tasks I have not had the time to test a – well nice to know thing with the “//” XPath [...]]]></description>
			<content:encoded><![CDATA[<p>In my daily work as frontend developer at <a href="http://www.bleau.dk">www.bleau.dk</a> I do a lot of <a href="http://www.netsi.dk/wordpress/index.php/tag/xslt/" class="st_tag internal_tag" rel="tag" title="Posts tagged with xslt">XSLT</a> “programming” – <a href="http://www.netsi.dk/wordpress/index.php/tag/xpath/" class="st_tag internal_tag" rel="tag" title="Posts tagged with XPath">XPath</a> is one of the things you need to master most. With the focus mainly set on closing tasks I have not had the time to test a – well nice to know thing with the “<a href="http://www.netsi.dk/wordpress/index.php/tag/164/" class="st_tag internal_tag" rel="tag" title="Posts tagged with //">//</a>” XPath <a href="http://www.netsi.dk/wordpress/index.php/tag/operator/" class="st_tag internal_tag" rel="tag" title="Posts tagged with operator">operator</a>. Tonight I finally found out what had been a question in my mind for at long period:</p>
<blockquote><p>The “//” (decendant-or-self) XPath operator: <em>Can</em> it be used <em><strong>relative</strong> </em>inside a full XPath? Will it “search” from the Document top, or start where it is placed inside the XPath selector?</p>
</blockquote>
<h3>An example XML:</h3>
</p>
<pre class="xml" name="code">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;people&gt;
&#160; &lt;group type=&quot;frontEnd&quot;&gt;
&#160;&#160;&#160; &lt;person name=&quot;Sten&quot; /&gt;
&#160; &lt;/group&gt;
&#160; &lt;group type=&quot;backend&quot;&gt;
&#160;&#160;&#160; &lt;person name=&quot;Sten&quot; /&gt;
&#160; &lt;/group&gt;
&lt;/people&gt;</pre>
<h3>The two XPaths</h3>
<p><code>//person[@name='Sten']</code> – Returns a nodeset containing <strong>2 elements</strong></p>
<p><code>//group[@type=&quot;frontEnd&quot;]//person[@name='Sten']</code> – Returns a nodeset containing only <strong>1 element</strong></p>
<p>So as you can see the first one looked from the <strong>root</strong> (/People) and <strong>anywhere</strong> inside the document. The second one had the “//” <em>inside</em> a XPath, which in made the “//” operator look <strong>from the spot it was and below</strong>. </p>
<h3>Conclusion</h3>
<p>Well, I just got a litle wiser as I learned that I actually can use the “//” operator inside XPath selectors. </p>
<h6>Links</h6>
<ul>
<li><a title="XSLT Reference at New Mexico Tech" href="https://infohost.nmt.edu/tcc/help/pubs/xslt/operator-sect.html">https://infohost.nmt.edu/tcc/help/pubs/xslt/operator-sect.html</a> </li>
</ul>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.netsi.dk%2Fwordpress%2Findex.php%2F2010%2F06%2F08%2Fusing-xpath-operator-aka-descendant-or-self-in-xslt%2F&amp;title=Using%20XPath%20operator%20%26ldquo%3B%2F%2F%26rdquo%3B%20aka%20%26ldquo%3Bdescendant-or-self%26rdquo%3B%20in%20XSLT" id="wpa2a_2"><img src="http://www.netsi.dk/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.netsi.dk/wordpress/index.php/2010/06/08/using-xpath-operator-aka-descendant-or-self-in-xslt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

