XCST — eXtensible C-Sharp Templates
XCST is a language optimized for the production of XML and other formats. It's a more general-purpose version of XSLT.
See the project home for more information.
| Package | Targets |
|---|---|
| Xcst.Compiler Compilation API. Use this package to translate your XCST programs into C# or Visual Basic code. |
.NET Framework 4.6 / .NET Core 2.0 / .NET Standard 2.0 |
| Xcst.Runtime Runtime and evaluation API. |
.NET Framework 4.6 / .NET Core 2.0 / .NET Standard 2.0 |
The documentation can be found at the project home.
v2 is the main branch for major version 2. See v1 for version 1 (no longer maintained).
The main focuses of v2 has been porting the compiler from XSLT to XCST and refining the language. While the runtime is not backwards compatible (programs compiled against v1 must be recompiled to run on v2), it is largely compatible because the implementation code is basically the same.
The compiler can generate code for runtime v1 or v2 (the default), but it supports only the latest language, and there are breaking changes. New language features that require special runtime support are not supported when targeting the v1 runtime.
Tests now run on .NET Core and compatibility with this framework is the priority.
c:modedeclarations- Copy null for
on-no-match='fail' c:apply-templatesandc:next-match'with-params' attributec:typenow include partial modifierc:member'serialize' attributec:function'partial' attributec:if'value' attributec:moduleandc:package'inherits' attribute- Allow text on
c:object - Implicit
c:on-emptywhen sequence type is nullable c:messagelistenerc:use-package/c:with-param- Use package file extension to find library packages
- Removed implicit unnamed mode
- Changed default built-in template rule to fail
- Fail compilation for
c:apply-templatesandc:next-matchwhen there are no modes in the current package - Changed default visibility of
c:templateon implicit packages to final - Changed the default separator for sequence constructors of
c:attributeandc:value-ofto single space - Renamed
c:metadatatoc:metaand 'name' attribute to 'type' - Renamed 'display-text-member' to 'text-member'
- Renamed 'null-display-text' to 'null-text'
- Renamed 'format' to 'use-format' (serialization)
- Don't assign local variable without value
- Resolve 'validation-resource-type' from
c:validationagainst package namespace, or treat as fully-qualified - Not using 'data-type' for validation
- Deprecated System.Delegate fallback on
c:invoke-delegateas it hides programming errors - Package parameters are not visible to using package (set with
c:use-package/c:with-param)
- Replaced QualifiedName with XName
- Moved IXcstPackage to root and merged PackageModel with Runtime
- C# 10 is required when targeting .NET 7+ (interpolated string handlers)
- On .NET 7+, dynamic expressions are not allowed in value templates (interpolated string handler implementation limitation)
- New simple content writer outputs the atomized value of all simple content instructions
The compiler produces code that is compatible with C# 6 and Visual Basic 14, although template rules are not useful unless you use C# 7 or higher.
The XCST schema is written in Relax NG and converted to XSD using Trang, which requires Java.