Example #1
0
        public virtual void testUNION()
        {
            String dvslstyle = "#match(\"p | document \")Matched#end";
            String input = "<?xml version=\"1.0\"?><document>document</document>";
            NVelocity.Dvsl.Dvsl dvsl = new NVelocity.Dvsl.Dvsl();

            /*
            *  register the stylesheet
            */

            dvsl.SetStylesheet(new StringReader(dvslstyle));

            /*
            *  render the document as a Reader
            */

            StringWriter sw = new StringWriter();

            dvsl.Transform(new StringReader(input), sw);

            Assertion.Assert("First Test : " + sw.ToString(), sw.ToString().Equals("Matched"));
        }
Example #2
0
        public virtual void testCDATA()
        {
            String dvslstyle = "#match(\"text()\")$node.value()#end";
            String input = "<?xml version=\"1.0\"?><document><![CDATA[Hello from CDATA]]></document>";
            NVelocity.Dvsl.Dvsl dvsl = new NVelocity.Dvsl.Dvsl();

            /*
            *  register the stylesheet
            */

            dvsl.SetStylesheet(new StringReader(dvslstyle));

            /*
            *  render the document as a Reader
            */

            StringWriter sw = new StringWriter();

            dvsl.Transform(new StringReader(input), sw);

            Assertion.Assert("First Test : " + sw.ToString(), sw.ToString().Equals("Hello from CDATA"));
        }
Example #3
0
        public virtual void  testUNION()
        {
            String dvslstyle = "#match(\"p | document \")Matched#end";
            String input     = "<?xml version=\"1.0\"?><document>document</document>";

            NVelocity.Dvsl.Dvsl dvsl = new NVelocity.Dvsl.Dvsl();

            /*
             *  register the stylesheet
             */

            dvsl.SetStylesheet(new StringReader(dvslstyle));

            /*
             *  render the document as a Reader
             */

            StringWriter sw = new StringWriter();

            dvsl.Transform(new StringReader(input), sw);

            Assertion.Assert("First Test : " + sw.ToString(), sw.ToString().Equals("Matched"));
        }
Example #4
0
        public virtual void  testCDATA()
        {
            String dvslstyle = "#match(\"text()\")$node.value()#end";
            String input     = "<?xml version=\"1.0\"?><document><![CDATA[Hello from CDATA]]></document>";

            NVelocity.Dvsl.Dvsl dvsl = new NVelocity.Dvsl.Dvsl();

            /*
             *  register the stylesheet
             */

            dvsl.SetStylesheet(new StringReader(dvslstyle));

            /*
             *  render the document as a Reader
             */

            StringWriter sw = new StringWriter();

            dvsl.Transform(new StringReader(input), sw);

            Assertion.Assert("First Test : " + sw.ToString(), sw.ToString().Equals("Hello from CDATA"));
        }