Example #1
0
        internal Action BuiltInTemplate(XPathNavigator node)
        {
            Debug.Assert(node != null);
            Action action = null;

            switch (node.NodeType)
            {
            //  <xsl:template match="*|/" [mode="?"]>
            //    <xsl:apply-templates [mode="?"]/>
            //  </xsl:template>
            case XPathNodeType.Element:
            case XPathNodeType.Root:
                Debug.WriteLine("->->->->-> Picking built-in rule for element (mode == \"" + this.mode + "\") <-<-<-<-<-");
                action = ApplyTemplatesAction.BuiltInRule(this.mode);
                break;

            //  <xsl:template match="text()|@*">
            //    <xsl:value-of select="."/>
            //  </xsl:template>
            case XPathNodeType.Attribute:
            case XPathNodeType.Whitespace:
            case XPathNodeType.SignificantWhitespace:
            case XPathNodeType.Text:
                Debug.WriteLine("->->->->-> Picking built-in rule for text or attribute <-<-<-<-<-");
                action = ValueOfAction.BuiltInRule();
                break;

            // <xsl:template match="processing-instruction()|comment()"/>
            case XPathNodeType.ProcessingInstruction:
            case XPathNodeType.Comment:
                // Empty action;
                break;

            case XPathNodeType.All:
                // Ignore the rest
                break;
            }

            return(action);
        }