<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>
</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) > 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"><!--><![CDATA[//><!--</xsl:text>
Some scripting code here...
<xsl:text disable-output-escaping="yes">//-->]]></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