Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2016-12-20 16:44:02 +0300
committerMarek Safar <marek.safar@gmail.com>2016-12-20 16:46:17 +0300
commitf3d036a1243173c0c0aa517f20f7a4f6daaac7df (patch)
treeeddc971a3d72bf728e7933f16178f99f18ee360a /mcs/class/System.XML/Test
parent93e845de160cb40830c74f5d0fd7fa82fe2f1d35 (diff)
[System.Xml] Add support for msxsl format functions. Fixes #50242
Diffstat (limited to 'mcs/class/System.XML/Test')
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs b/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
index b080ba02710..3a0594d1b23 100644
--- a/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Xsl/XslTransformTests.cs
@@ -172,6 +172,32 @@ xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl='urn:schemas-micros
}
[Test]
+ public void MSXslFormatDate ()
+ {
+ var arguments = new XsltArgumentList();
+ arguments.AddParam("date", "", new DateTime (2010, 11, 22, 5, 4, 3));
+
+ string xsl = @"
+<xsl:stylesheet version=""1.0"" xmlns=""http://www.w3.org/1999/xhtml"" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"" xmlns:msxsl=""urn:schemas-microsoft-com:xslt"" exclude-result-prefixes=""msxsl"">
+<xsl:param name='date'/>
+<xsl:template match='/'>
+ <root>
+ <p>The current date is <xsl:value-of select=""msxsl:format-date($date, 'd MMMM yyyy')""/> and current time is <xsl:value-of select=""msxsl:format-time($date, 'HH:mm')""/>.</p>
+ </root>
+</xsl:template>
+</xsl:stylesheet>";
+
+ StringWriter sw = new StringWriter ();
+ var t = new XslCompiledTransform ();
+ t.Load (new XPathDocument (new StringReader (xsl)));
+
+ t.Transform (new XPathDocument (new XmlTextReader (new StringReader ("<root></root>"))), arguments, sw);
+
+ Assert.AreEqual ("<?xml version=\"1.0\" encoding=\"utf-16\"?><root xmlns=\"http://www.w3.org/1999/xhtml\"><p>The current date is 22 November 2010 and current time is 05:04.</p></root>", sw.ToString ());
+ }
+
+
+ [Test]
public void EvaluateEmptyVariableAsBoolean ()
{
string xsl = @"<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>