<?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/"
	>

<channel>
	<title>Expressing IT &#187; XSL Quirks</title>
	<atom:link href="http://developer.expressionz.in/blogs/tag/xsl-quirks/feed/" rel="self" type="application/rss+xml" />
	<link>http://developer.expressionz.in/blogs</link>
	<description>User Interface : just another, but a serious developers weblog</description>
	<lastBuildDate>Thu, 20 May 2010 18:05:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>TEXTAREA Collapse problem in XSL/XSLT</title>
		<link>http://developer.expressionz.in/blogs/2008/09/20/textarea-collapse-problem-in-xslxslt/</link>
		<comments>http://developer.expressionz.in/blogs/2008/09/20/textarea-collapse-problem-in-xslxslt/#comments</comments>
		<pubDate>Sat, 20 Sep 2008 07:26:12 +0000</pubDate>
		<dc:creator>Nikhil</dc:creator>
				<category><![CDATA[XSL]]></category>
		<category><![CDATA[XSL Quirks]]></category>

		<guid isPermaLink="false">http://developer.expressionz.in/blogs/?p=36</guid>
		<description><![CDATA[
			
				
			
		

PROBLEM STATEMENT:
I ran into this a problem regarding textareas in XSLs.  In simple words, the problem arises when you have a blank &#60;textarea&#62; tag, then it will collapse it to &#60;textarea /&#62;.
i.e. if you had something like the following in your XSL and the XML data for the TEXTAREA value, returns nothing…
&#60;textarea name=&#8217;description&#8217; &#62;&#60;xsl:value-of select=&#8221;DESCRIPTION&#8221;/&#62;&#60;/textarea&#62;
As [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fdeveloper.expressionz.in%2Fblogs%2F2008%2F09%2F20%2Ftextarea-collapse-problem-in-xslxslt%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fdeveloper.expressionz.in%2Fblogs%2F2008%2F09%2F20%2Ftextarea-collapse-problem-in-xslxslt%2F&amp;source=nikhild&amp;style=normal&amp;hashtags=XSL+Quirks" height="61" width="50" /><br />
			</a>
		</div>
<p><strong><br />
PROBLEM STATEMENT:</strong><br />
I ran into this a problem regarding textareas in XSLs.  In simple words, the problem arises when you have a blank &lt;textarea&gt; tag, then it will collapse it to &lt;textarea /&gt;.<br />
i.e. if you had something like the following in your XSL and the XML data for the TEXTAREA value, returns nothing…</p>
<blockquote><p>&lt;textarea name=&#8217;description&#8217; &gt;&lt;xsl:value-of select=&#8221;DESCRIPTION&#8221;/&gt;&lt;/textarea&gt;</p></blockquote>
<p>As browsers don’t recognise this, it will cause the rest of the form HTML to run into the text area.</p>
<p><strong>POSSIBLE SOLUTIONS:</strong></p>
<blockquote><p>In the XSL, add a non-breaking-space ( ) after the xsl:value tag.BEWARE, to take care of this extra space you added, during client side validations of this field.</p>
<p>&lt;textarea  name=&#8217;description&#8217; &gt;&lt;xsl:value-of select=&#8221;DESCRIPTION&#8221;/&gt; &lt;/textarea&gt;</p>
<p><strong>Or</strong><br />
&lt;xsl:value-of select=&#8221;concat (DESCRIPTION,&#8217; &#8216;)&#8221;/&gt;</p>
<p><strong>Or</strong><br />
Insert a &lt;xsl:value-of select=”@unknown&#8221; /&gt; tag pointing to an unknown attribute. This will force the PHP XSLT parser to generate an opening and closing text area tag, even if it has nothing in between.</p>
<p><strong>Or</strong><br />
Insert a &lt;xsl:text&gt; field containing a space to force a closing tag.</p></blockquote>
<p>However, though the above mentioned solutions might seem to fix the problem, I am still not convinced that they are right and best ways to fix it. If there is any other better way of fixing this quirk, Please do let us know.</p>
]]></content:encoded>
			<wfw:commentRss>http://developer.expressionz.in/blogs/2008/09/20/textarea-collapse-problem-in-xslxslt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A problem with position() in XSL &#8230; or is it?</title>
		<link>http://developer.expressionz.in/blogs/2008/08/04/problem-with-position-in-xsl/</link>
		<comments>http://developer.expressionz.in/blogs/2008/08/04/problem-with-position-in-xsl/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 13:33:59 +0000</pubDate>
		<dc:creator>Nikhil</dc:creator>
				<category><![CDATA[XSL]]></category>
		<category><![CDATA[XSL Quirks]]></category>
		<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://developer.expressionz.in/blogs/?p=17</guid>
		<description><![CDATA[
			
				
			
		
I had this strage problem while creating a XSL today. Looked for answers throughout the net, but couldnt find any &#8230;. Actually I guess! I dint know what my problem was, so what do I look for?
Anyway! Just in case you have this very same problem too and somehow by the power of the FORCE [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fdeveloper.expressionz.in%2Fblogs%2F2008%2F08%2F04%2Fproblem-with-position-in-xsl%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fdeveloper.expressionz.in%2Fblogs%2F2008%2F08%2F04%2Fproblem-with-position-in-xsl%2F&amp;source=nikhild&amp;style=normal&amp;hashtags=XSL,XSL+Quirks,XSLT" height="61" width="50" /><br />
			</a>
		</div>
<p>I had this strage problem while creating a XSL today. Looked for answers throughout the net, but couldnt find any &#8230;. Actually I guess! I dint know what my problem was, so what do I look for?</p>
<p>Anyway! Just in case you have this very same problem too and somehow by the power of the FORCE you managed to land on this page &#8230; you would thank me tons &#8230; And if you have accidently landed on this page for some strange fate and you happen to be a XSL developer , <strong>DO MAKE A NOTE OF THIS NOW, FOR THE FUTURE</strong> cause, If some day, you face this issue, then the FORCE might not be with you.</p>
<p><strong>Problem statement:</strong><br />
I have this XML , where there are two nodes with multiple items in it and the items between these two nodes have a one to one correspondence. In the example below, each item in the node <strong>&lt;array name=&#8221;PLAYURL&#8221; /&gt;</strong> relates( corresponding position) to an item in the node <strong>&lt;array name=&#8221;SITENAME&#8221; /&gt;</strong></p>
<blockquote><p><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;<br />
&lt;myplaylists&gt;<br />
&lt;playlist&gt;<br />
&lt;title&gt;Best of Rest &lt;/title&gt;<br />
&lt;array name="SITENAME"&gt;<br />
&lt;str&gt;www.musicindiaonline.com&lt;/str&gt;<br />
&lt;str&gt;www.dhingana.com&lt;/str&gt;<br />
&lt;str&gt;www.raaga.com&lt;/str&gt;<br />
&lt;str&gt;www.smashits.com&lt;/str&gt;<br />
&lt;str&gt;www.desimusic.com&lt;/str&gt;<br />
&lt;str&gt;www.musicplug.in&lt;/str&gt;<br />
&lt;/array&gt;<br />
&lt;array name="PLAYURL"&gt;<br />
&lt;str&gt;http://www.musicindiaonline.com/123/&lt;/str&gt;<br />
&lt;str&gt;http://www.dhingana.com/play/123&lt;/str&gt;<br />
&lt;str&gt;http://www.raaga.com/123&lt;/str&gt;<br />
&lt;str&gt;http://ww.smashits.com/123&lt;/str&gt;<br />
&lt;str&gt;http://www.desimusic.com/123&lt;/str&gt;<br />
&lt;str&gt;http://www.musicplug.in/123&lt;/str&gt;<br />
&lt;/array&gt;<br />
&lt;/playlist&gt;<br />
&lt;/myplaylists&gt;</code></p></blockquote>
<p>Now, I have a loop , where i loop through <strong>&lt;array name=&#8221;SITENAME&#8221;&gt;</strong>, and I want to get the related item( at the corresponding position) in <strong>&lt;array name=&#8221;PLAYURL&#8221;&gt;</strong>,</p>
<p><strong>What you would normaly try do is &#8230;</strong></p>
<blockquote><p><code>&lt;xsl:for-each select="myplaylists/playlist/array[@name='SITENAME']/str"&gt;<br />
play from : &lt;a href="{../../array[@name='PLAY']/str[position()]}"/&gt; &lt;xsl:value-of select="." /&gt;&lt;/a&gt;<br />
&lt;/xsl:for-each&gt;</code></p></blockquote>
<p><strong>SORRY!! THIS WONT WORK &#8230; Ah!!!! Surpised &#8230;</strong></p>
<p>Now you would probably want to try , something like this &#8230;</p>
<blockquote><p><code>&lt;xsl:for-each select="myplaylists/playlist/array[@name='SITENAME']/str"&gt;<br />
&lt;xsl:variable name="pos"&gt; &lt;xsl:value-of select="position()"/&gt;&lt;/xsl:variable&gt;<br />
play from : &lt;a href="{../../array[@name='PLAY']/str[$pos]}"/&gt; &lt;xsl:value-of select="." /&gt;&lt;/a&gt;<br />
&lt;/xsl:for-each&gt;<br />
</code></p></blockquote>
<p>And Again this wont work &#8230; Now you scratching your head, trying to contact everyone who you think knows some XSL and could be of any help &#8230; you try every other option &#8230; and still it wont work &#8230; Well! Thats what happened to me atleast &#8230;</p>
<p><strong>DONT DESPAIR !!! TRY THIS </strong></p>
<blockquote><p><code>&lt;xsl:for-each select="myplaylists/playlist/array[@name='SITENAME']/str"&gt;<br />
&lt;xsl:variable name="pos-int" select="position()" /&gt;<br />
play from : &lt;a href="{../../array[@name='PLAY']/str[$</code><code>pos-int</code><code>]}"/&gt; &lt;xsl:value-of select="." /&gt;&lt;/a&gt;<br />
&lt;/xsl:for-each&gt;<br />
</code></p></blockquote>
<p>DONT ASK ME WHY IT WORKS. Cause i dont have a right reason&#8230; if you do! Please do drop a comment. It might be pretty usefull. Also! if you have better TITLE for this post, do drop me a line <img src='http://developer.expressionz.in/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://developer.expressionz.in/blogs/2008/08/04/problem-with-position-in-xsl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
