Sunday, May 23, 2010

Deadlock or Stop may happen when Using ServerXMLHTTP or XMLDocument Requests and Load Page to the Same Server

If you are failed to using ServerXMLHTTP send the request or using XMLDocument load a page in the same Server, you have to take look this below...
 
Using ServerXMLHTTP or WinHTTP objects to make recursive Hypertext Transfer Protocol (HTTP) requests to the same Internet Information Server (IIS) server is not recommended.
 
If the ServerXMLHTTP or WinHTTP component must send a request to another ASP on the same server, the target ASP must be located in a different virtual directory and set to run in high isolation. Avoid using ServerXMLHTTP or WinHTTP to send a request to an ASP that is located in the same virtual directory.
 
If all of the ASP worker threads send HTTP requests back to the same Inetinfo.exe or Dllhost.exe process on the server from which the requests are sent, the Inetinfo.exe or Dllhost.exe process may deadlock or stop responding (hang)
 
 
 
How Resolve This Problem
For IIS 6.0 you can create a new application pool, put all the request pages in a virtual directory and set the Application Pool to the new pool.
 

Saturday, May 15, 2010

XSLT Samples

<List>
    <Item name="xslt sample1">
        <fieldName>sTitle</fieldName>
        <Value>This is Sample fo xslt</Value>
    </Item>
    <Item name="xslt sample2">
        <fieldName>PostDate</fieldName>
        <Value>This is Sample fo xslt</Value>
    </Item>
</List>

<xsl:value-of select="."/>
<xsl:value-of select="List/Item/@name"/>
<xsl:value-of select=""List/Item[@name='xslt sample2']" />
<xsl:value-of select=""List/Item[fieldName='PostDate']/Value" />
<xsl:value-of select="parent::Item/@srId" />
<xsl:if test="string(number(rssCount))!='NaN'"> .... </xsl:if>

................................................................................................
<xsl:template match="Item/Value">
    <xsl:value-of select="text()"/>
</xsl:template>

<!-- HTML textarea closed tag issue-->
<textarea><xsl:text>&#xA;</xsl:text></textarea>

<!--Get TagName -->
<xsl:value-of select="name()"/>

<xsl:if test="count(Item) < 3"> The Item has less than 3 elements. </xsl:if>


<xsl:if test="count(Item) &gt; 3"> The Item has more than 3 elements. </xsl:if>

About Using <!CDATA[[ ... ]]> If you want to output a text wrapped by <!CDATA[[]]> to another xml, you can do this as below.
Some times you want to output it to an HTML through xsl transformer, the transformer will not to proccess the CDATA been output in a text as below. 
<script type="text/javascript"> 
 
    // the transformer result should look like:
    // <!--
    //     Some scripting code here... 
    // -->
    <xsl:text disable-output-escaping="yes">&lt;!--&gt;&lt;![CDATA[//&gt;&lt;!--</xsl:text> 
        Some scripting code here...
    <xsl:text disable-output-escaping="yes">//--&gt;]]&gt;</xsl:text>
 
    // this trans result same as above but more simple and clear 
    <xsl:comment><![CDATA[        Some scripting code here...    ]]> </xsl:comment> 
</script>
 
If you want the xsl output wrapped by <!CDATA[[ ... ]]>, Only one way i knew can do it that is cdata-section-elements.
You can add cdata-section-elements in xsl:output, each cdata-section-elements could contains one valu, but you can 
add more than one xsl:output, see the sample.
 
<xsl:output method="html" cdata-section-elements="title" />
<xsl:output cdata-section-elements="content" />
.....
<xsl:template match="content">
   your content here....
</xsl:template>
....
<xsl:apply-templates select="content" />
 
xsl output is:
<!CDATA[[your content here....]]>
 
Related
http://www.w3schools.com/xsl/default.asp
http://msdn.microsoft.com/en-us/library/ms256086%28VS.85%29.aspx
http://www.dpawson.co.uk/xsl/sect2/N8413.html
http://www.xml.com/pub/a/2003/04/02/trxml.html
http://www.brics.dk/~amoeller/XML/transformation/examples.html