コード例 #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 Attribute_String_CreatesElement()
        {
            var xslt      = new XsltFactory();
            var name      = "testName";
            var attribute = xslt.Attribute(name);

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