示例#1
0
        internal XsltElement GetOutputElement(IFieldData fieldData)
        {
            switch (fieldData?.ContentType)
            {
            case ContentType.Variable:
                return(xslt.Variable(fieldData.Name));

            case ContentType.Attribute:
                return(xslt.Attribute(fieldData.Name));

            case ContentType.Element:
                return(xslt.Element(fieldData.Name));

            case ContentType.Text:
                return(xslt.Text());

            case ContentType.Number:
                return(xslt.Number());

            case ContentType.Calculation:
            case ContentType.Aggregation:
                return(xslt.ValueOf(fieldData.Name));

            default:
                return(null);
            }
        }
示例#2
0
        public void Variable_String_CreatesElement()
        {
            var xslt     = new XsltFactory();
            var name     = "testName";
            var variable = xslt.Variable(name);

            Assert.Equal("variable", variable.Name.LocalName);
            Assert.Contains(variable.Attributes(), a => a.Name == "name" && a.Value == name);
        }