<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Генерация URL&#8217;ов в XSLT 1.0</title>
	<atom:link href="http://flack.ru/2007/12/13/urls-generation-in-xslt-10/feed/" rel="self" type="application/rss+xml" />
	<link>http://flack.ru/2007/12/13/urls-generation-in-xslt-10/</link>
	<description>Вебдев и всякая фигня</description>
	<lastBuildDate>Sun, 05 Sep 2010 12:35:53 +0400</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: keep</title>
		<link>http://flack.ru/2007/12/13/urls-generation-in-xslt-10/comment-page-1/#comment-830</link>
		<dc:creator>keep</dc:creator>
		<pubDate>Thu, 10 Jan 2008 12:34:59 +0000</pubDate>
		<guid isPermaLink="false">http://flack.ru/2007/12/13/urls-generation-in-xslt-10/#comment-830</guid>
		<description>читаемость прежде всего: никто не увидит гибкости в непонятном коде.</description>
		<content:encoded><![CDATA[<p>читаемость прежде всего: никто не увидит гибкости в непонятном коде.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KBA-KBA</title>
		<link>http://flack.ru/2007/12/13/urls-generation-in-xslt-10/comment-page-1/#comment-828</link>
		<dc:creator>KBA-KBA</dc:creator>
		<pubDate>Tue, 08 Jan 2008 22:11:47 +0000</pubDate>
		<guid isPermaLink="false">http://flack.ru/2007/12/13/urls-generation-in-xslt-10/#comment-828</guid>
		<description>Согласен. Это плата за гибкость</description>
		<content:encoded><![CDATA[<p>Согласен. Это плата за гибкость</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://flack.ru/2007/12/13/urls-generation-in-xslt-10/comment-page-1/#comment-827</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 08 Jan 2008 21:06:47 +0000</pubDate>
		<guid isPermaLink="false">http://flack.ru/2007/12/13/urls-generation-in-xslt-10/#comment-827</guid>
		<description>Вполне резонно. Но мне не нравится читаемость такого варианта.</description>
		<content:encoded><![CDATA[<p>Вполне резонно. Но мне не нравится читаемость такого варианта.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KBA-KBA</title>
		<link>http://flack.ru/2007/12/13/urls-generation-in-xslt-10/comment-page-1/#comment-826</link>
		<dc:creator>KBA-KBA</dc:creator>
		<pubDate>Tue, 08 Jan 2008 20:34:42 +0000</pubDate>
		<guid isPermaLink="false">http://flack.ru/2007/12/13/urls-generation-in-xslt-10/#comment-826</guid>
		<description>Сначала подумал и переписал шаблоны (оба) &lt;code&gt;match=&quot;param&quot;&lt;/code&gt;
так (DRY):
&lt;code&gt;
&lt;xsl:template match=&quot;param&quot; mode=&quot;value&quot;&gt;
	&lt;xsl:value-of select=&quot;@name&quot;/&gt;=&lt;xsl:value-of select=&quot;.&quot;/&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match=&quot;param[position()=1]&quot;&gt;
	&lt;xsl:text&gt;?&lt;/xsl:text&gt;
	&lt;xsl:apply-templates select=&quot;.&quot; mode=&quot;value&quot;/&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match=&quot;param[position()&gt;1]&quot;&gt;
	&lt;xsl:text&gt;&amp;&lt;/xsl:text&gt;
	&lt;xsl:apply-templates select=&quot;.&quot; mode=&quot;value&quot;/&gt;
&lt;/xsl:template&gt;
&lt;/code&gt;

Потом подумал, что я бы написал так:
&lt;code&gt;
&lt;xsl:key name=&quot;href&quot; match=&quot;/page/state&quot; use=&quot;@name&quot;/&gt;

&lt;xsl:template match=&quot;/&quot;&gt;
	&lt;html&gt;
		&lt;head&gt;
				&lt;title&gt;Custom page name&lt;/title&gt;
		&lt;/head&gt;
		&lt;body&gt;
			&lt;div id=&quot;place-holder&quot;&gt;
				&lt;p&gt;Текущий URL: http://example.com/index.xml?section=catalog&amp;cat-id=10&amp;item-id=1404&amp;item-unique-key=809124&lt;/p&gt;
				&lt;ul&gt;
					&lt;li&gt;
						&lt;a&gt;
							&lt;xsl:attribute name=&quot;href&quot;&gt;
								&lt;xsl:apply-templates select=&quot;key(&apos;href&apos;,&apos;request&apos;)&quot;&gt;
									&lt;xsl:with-param name=&quot;params&quot;&gt;
										&lt;xsl:apply-templates select=&quot;key(&apos;href&apos;,&apos;request&apos;)/param[not(contains(&apos;item-id&#124;item-unique-key&apos;,@name))]&quot; mode=&quot;value&quot;/&gt;								    &lt;/xsl:with-param&gt;
								&lt;/xsl:apply-templates&gt;
							&lt;/xsl:attribute&gt;
							Ссылка на общую страницу категории
						&lt;/a&gt;
					&lt;/li&gt;				    
					&lt;li&gt;
						&lt;a&gt;
							&lt;xsl:attribute name=&quot;href&quot;&gt;
								&lt;xsl:apply-templates select=&quot;key(&apos;href&apos;,&apos;request&apos;)&quot;&gt;
									&lt;xsl:with-param name=&quot;params&quot;&gt;
										&lt;xsl:apply-templates select=&quot;key(&apos;href&apos;,&apos;request&apos;)/param[@name=&apos;cat-id&apos;]&quot; mode=&quot;value&quot;/&gt;
									&lt;/xsl:with-param&gt;
								&lt;/xsl:apply-templates&gt;
							&lt;/xsl:attribute&gt;
							Ссылка на страницу итема, безотносительно категории
						&lt;/a&gt;
					&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/div&gt;
		&lt;/body&gt;
	&lt;/html&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match=&quot;state&quot;&gt;
	&lt;xsl:param name=&quot;params&quot; select=&quot;&apos;&apos;&quot;/&gt;
	&lt;xsl:text&gt;http://example.com/index.xml&lt;/xsl:text&gt;&lt;xsl:if test=&quot;string-length($params)&quot;&gt;?&lt;xsl:value-of select=&quot;$params&quot;/&gt;&lt;/xsl:if&gt;
&lt;/xsl:template&gt;

&lt;xsl:template match=&quot;param&quot; mode=&quot;value&quot;&gt;
	&lt;xsl:if test=&quot;position()&gt;1&quot;&gt;&lt;xsl:text&gt;&amp;&lt;/xsl:text&gt;&lt;/xsl:if&gt;&lt;xsl:value-of select=&quot;@name&quot;/&gt;=&lt;xsl:value-of select=&quot;.&quot;/&gt;
&lt;/xsl:template&gt;
&lt;/code&gt;
(поправил комментарий, было не понятно включен HTML или нет)</description>
		<content:encoded><![CDATA[<p>Сначала подумал и переписал шаблоны (оба) <code>match="param"</code><br />
так (DRY):<br />
<code><br />
&lt;xsl:template match=&quot;param&quot; mode=&quot;value&quot;&gt;<br />
	&lt;xsl:value-of select=&quot;@name&quot;/&gt;=&lt;xsl:value-of select=&quot;.&quot;/&gt;<br />
&lt;/xsl:template&gt;</p>
<p>&lt;xsl:template match=&quot;param[position()=1]&quot;&gt;<br />
	&lt;xsl:text&gt;?&lt;/xsl:text&gt;<br />
	&lt;xsl:apply-templates select=&quot;.&quot; mode=&quot;value&quot;/&gt;<br />
&lt;/xsl:template&gt;</p>
<p>&lt;xsl:template match=&quot;param[position()&amp;gt;1]&quot;&gt;<br />
	&lt;xsl:text&gt;&amp;amp;&lt;/xsl:text&gt;<br />
	&lt;xsl:apply-templates select=&quot;.&quot; mode=&quot;value&quot;/&gt;<br />
&lt;/xsl:template&gt;<br />
</code></p>
<p>Потом подумал, что я бы написал так:<br />
<code><br />
&lt;xsl:key name=&quot;href&quot; match=&quot;/page/state&quot; use=&quot;@name&quot;/&gt;</p>
<p>&lt;xsl:template match=&quot;/&quot;&gt;<br />
	&lt;html&gt;<br />
		&lt;head&gt;<br />
				&lt;title&gt;Custom page name&lt;/title&gt;<br />
		&lt;/head&gt;<br />
		&lt;body&gt;<br />
			&lt;div id=&quot;place-holder&quot;&gt;<br />
				&lt;p&gt;Текущий URL: <a href="http://example.com/index.xml?section=catalog&amp;amp;cat-id=10&amp;amp;item-id=1404&amp;amp;item-unique-key=809124&#038;lt;/p&#038;gt" rel="nofollow">http://example.com/index.xml?section=catalog&amp;amp;cat-id=10&amp;amp;item-id=1404&amp;amp;item-unique-key=809124&#038;lt;/p&#038;gt</a>;<br />
				&lt;ul&gt;<br />
					&lt;li&gt;<br />
						&lt;a&gt;<br />
							&lt;xsl:attribute name=&quot;href&quot;&gt;<br />
								&lt;xsl:apply-templates select=&quot;key(&apos;href&apos;,&apos;request&apos;)&quot;&gt;<br />
									&lt;xsl:with-param name=&quot;params&quot;&gt;<br />
										&lt;xsl:apply-templates select=&quot;key(&apos;href&apos;,&apos;request&apos;)/param[not(contains(&apos;item-id|item-unique-key&apos;,@name))]&quot; mode=&quot;value&quot;/&gt;								    &lt;/xsl:with-param&gt;<br />
								&lt;/xsl:apply-templates&gt;<br />
							&lt;/xsl:attribute&gt;<br />
							Ссылка на общую страницу категории<br />
						&lt;/a&gt;<br />
					&lt;/li&gt;<br />
					&lt;li&gt;<br />
						&lt;a&gt;<br />
							&lt;xsl:attribute name=&quot;href&quot;&gt;<br />
								&lt;xsl:apply-templates select=&quot;key(&apos;href&apos;,&apos;request&apos;)&quot;&gt;<br />
									&lt;xsl:with-param name=&quot;params&quot;&gt;<br />
										&lt;xsl:apply-templates select=&quot;key(&apos;href&apos;,&apos;request&apos;)/param[@name=&apos;cat-id&apos;]&quot; mode=&quot;value&quot;/&gt;<br />
									&lt;/xsl:with-param&gt;<br />
								&lt;/xsl:apply-templates&gt;<br />
							&lt;/xsl:attribute&gt;<br />
							Ссылка на страницу итема, безотносительно категории<br />
						&lt;/a&gt;<br />
					&lt;/li&gt;<br />
				&lt;/ul&gt;<br />
			&lt;/div&gt;<br />
		&lt;/body&gt;<br />
	&lt;/html&gt;<br />
&lt;/xsl:template&gt;</p>
<p>&lt;xsl:template match=&quot;state&quot;&gt;<br />
	&lt;xsl:param name=&quot;params&quot; select=&quot;&apos;&apos;&quot;/&gt;<br />
	&lt;xsl:text&gt;http://example.com/index.xml&lt;/xsl:text&gt;&lt;xsl:if test=&quot;string-length($params)&quot;&gt;?&lt;xsl:value-of select=&quot;$params&quot;/&gt;&lt;/xsl:if&gt;<br />
&lt;/xsl:template&gt;</p>
<p>&lt;xsl:template match=&quot;param&quot; mode=&quot;value&quot;&gt;<br />
	&lt;xsl:if test=&quot;position()&amp;gt;1&quot;&gt;&lt;xsl:text&gt;&amp;amp;&lt;/xsl:text&gt;&lt;/xsl:if&gt;&lt;xsl:value-of select=&quot;@name&quot;/&gt;=&lt;xsl:value-of select=&quot;.&quot;/&gt;<br />
&lt;/xsl:template&gt;<br />
</code><br />
(поправил комментарий, было не понятно включен HTML или нет)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://flack.ru/2007/12/13/urls-generation-in-xslt-10/comment-page-1/#comment-808</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Wed, 26 Dec 2007 16:16:20 +0000</pubDate>
		<guid isPermaLink="false">http://flack.ru/2007/12/13/urls-generation-in-xslt-10/#comment-808</guid>
		<description>&lt;b&gt;veged&lt;/b&gt;, честно говоря, ни по одному из пунктов толком тебя не понял.
* про xpath не понимаю сходу разницу. На мой взгляд, обычной строкой лучше читается в коде. Или речь о фильтрации прямо в select&#039;е у apply?

Про str:encode-uri проблему не понял. Не использовал почти.</description>
		<content:encoded><![CDATA[<p><b>veged</b>, честно говоря, ни по одному из пунктов толком тебя не понял.<br />
* про xpath не понимаю сходу разницу. На мой взгляд, обычной строкой лучше читается в коде. Или речь о фильтрации прямо в select&#8217;е у apply?</p>
<p>Про str:encode-uri проблему не понял. Не использовал почти.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: veged</title>
		<link>http://flack.ru/2007/12/13/urls-generation-in-xslt-10/comment-page-1/#comment-807</link>
		<dc:creator>veged</dc:creator>
		<pubDate>Wed, 26 Dec 2007 16:07:19 +0000</pubDate>
		<guid isPermaLink="false">http://flack.ru/2007/12/13/urls-generation-in-xslt-10/#comment-807</guid>
		<description>Мне стиль не понравился =(
  * строки -- это не стихия xsl, зачем писать &#039;item-id&#124;item-unique-key&#039; строкой если есть xpath
  * следующий кусок раскопипащен:
    &lt;xsl:value-of select=&quot;@name&quot;/&gt;
    &lt;xsl:text&gt;=&lt;/xsl:text&gt;
    &lt;xsl:value-of select=&quot;.&quot;/&gt;
  * почему копипаст это плохо становится ясно при добавлении str:encode-uri() к выводу значений</description>
		<content:encoded><![CDATA[<p>Мне стиль не понравился =(<br />
  * строки &#8212; это не стихия xsl, зачем писать &#8216;item-id|item-unique-key&#8217; строкой если есть xpath<br />
  * следующий кусок раскопипащен:<br />
    &lt;xsl:value-of select=&#8221;@name&#8221;/&gt;<br />
    &lt;xsl:text&gt;=&lt;/xsl:text&gt;<br />
    &lt;xsl:value-of select=&#8221;.&#8221;/&gt;<br />
  * почему копипаст это плохо становится ясно при добавлении str:encode-uri() к выводу значений</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: keep</title>
		<link>http://flack.ru/2007/12/13/urls-generation-in-xslt-10/comment-page-1/#comment-742</link>
		<dc:creator>keep</dc:creator>
		<pubDate>Sun, 16 Dec 2007 01:17:36 +0000</pubDate>
		<guid isPermaLink="false">http://flack.ru/2007/12/13/urls-generation-in-xslt-10/#comment-742</guid>
		<description>Хороший стиль и красиво, особенно для 1.0. 

Думаю с 2.0 то же можно написать в пару XPath :) Если в ближайшее время доживу до блога, жди 2.0 ответ :)</description>
		<content:encoded><![CDATA[<p>Хороший стиль и красиво, особенно для 1.0. </p>
<p>Думаю с 2.0 то же можно написать в пару XPath :) Если в ближайшее время доживу до блога, жди 2.0 ответ :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
