Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / TemplateLookupAction.cs / 1 / TemplateLookupAction.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
namespace System.Xml.Xsl.XsltOld {
using Res = System.Xml.Utils.Res;
using System;
using System.Diagnostics;
using System.Xml;
using System.Xml.XPath;
internal class TemplateLookupAction : Action {
protected XmlQualifiedName mode;
protected Stylesheet importsOf;
internal void Initialize(XmlQualifiedName mode, Stylesheet importsOf) {
this.mode = mode;
this.importsOf = importsOf;
}
internal override void Execute(Processor processor, ActionFrame frame) {
Debug.Assert(processor != null && frame != null);
Debug.Assert(frame.State == Initialized);
Action action = null;
if (this.mode != null) {
action = importsOf == null
? processor.Stylesheet.FindTemplate(processor, frame.Node, this.mode)
: importsOf.FindTemplateImports(processor, frame.Node, this.mode);
}
else {
action = importsOf == null
? processor.Stylesheet.FindTemplate(processor, frame.Node)
: importsOf.FindTemplateImports(processor, frame.Node);
}
// Built-int template rules
if (action == null) {
action = BuiltInTemplate(frame.Node);
}
// Jump
if (action != null) {
frame.SetAction(action);
}
else {
frame.Finished();
}
}
internal Action BuiltInTemplate(XPathNavigator node) {
Debug.Assert(node != null);
Action action = null;
switch (node.NodeType) {
//
//
//
case XPathNodeType.Element:
case XPathNodeType.Root:
action = ApplyTemplatesAction.BuiltInRule(this.mode);
break;
//
//
//
case XPathNodeType.Attribute:
case XPathNodeType.Whitespace:
case XPathNodeType.SignificantWhitespace:
case XPathNodeType.Text:
action = ValueOfAction.BuiltInRule();
break;
//
case XPathNodeType.ProcessingInstruction:
case XPathNodeType.Comment:
// Empty action;
break;
case XPathNodeType.All:
// Ignore the rest
break;
}
return action;
}
}
internal class TemplateLookupActionDbg : TemplateLookupAction {
internal override void Execute(Processor processor, ActionFrame frame) {
Debug.Assert(processor != null && frame != null);
Debug.Assert(frame.State == Initialized);
Debug.Assert(processor.Debugger != null);
Action action = null;
if (this.mode == Compiler.BuiltInMode) {
// mode="*" -- use one from debuggerStack
this.mode = processor.GetPrevioseMode();
Debug.Assert(this.mode != Compiler.BuiltInMode);
}
processor.SetCurrentMode(this.mode);
if (this.mode != null) {
action = importsOf == null
? processor.Stylesheet.FindTemplate(processor, frame.Node, this.mode)
: importsOf.FindTemplateImports(processor, frame.Node, this.mode);
}
else {
action = importsOf == null
? processor.Stylesheet.FindTemplate(processor, frame.Node)
: importsOf.FindTemplateImports(processor, frame.Node);
}
// Built-int template rules
if (action == null && processor.RootAction.builtInSheet != null) {
action = processor.RootAction.builtInSheet.FindTemplate(processor, frame.Node, Compiler.BuiltInMode);
}
if (action == null) {
action = BuiltInTemplate(frame.Node);
}
// Jump
if (action != null) {
frame.SetAction(action);
}
else {
frame.Finished();
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
namespace System.Xml.Xsl.XsltOld {
using Res = System.Xml.Utils.Res;
using System;
using System.Diagnostics;
using System.Xml;
using System.Xml.XPath;
internal class TemplateLookupAction : Action {
protected XmlQualifiedName mode;
protected Stylesheet importsOf;
internal void Initialize(XmlQualifiedName mode, Stylesheet importsOf) {
this.mode = mode;
this.importsOf = importsOf;
}
internal override void Execute(Processor processor, ActionFrame frame) {
Debug.Assert(processor != null && frame != null);
Debug.Assert(frame.State == Initialized);
Action action = null;
if (this.mode != null) {
action = importsOf == null
? processor.Stylesheet.FindTemplate(processor, frame.Node, this.mode)
: importsOf.FindTemplateImports(processor, frame.Node, this.mode);
}
else {
action = importsOf == null
? processor.Stylesheet.FindTemplate(processor, frame.Node)
: importsOf.FindTemplateImports(processor, frame.Node);
}
// Built-int template rules
if (action == null) {
action = BuiltInTemplate(frame.Node);
}
// Jump
if (action != null) {
frame.SetAction(action);
}
else {
frame.Finished();
}
}
internal Action BuiltInTemplate(XPathNavigator node) {
Debug.Assert(node != null);
Action action = null;
switch (node.NodeType) {
//
//
//
case XPathNodeType.Element:
case XPathNodeType.Root:
action = ApplyTemplatesAction.BuiltInRule(this.mode);
break;
//
//
//
case XPathNodeType.Attribute:
case XPathNodeType.Whitespace:
case XPathNodeType.SignificantWhitespace:
case XPathNodeType.Text:
action = ValueOfAction.BuiltInRule();
break;
//
case XPathNodeType.ProcessingInstruction:
case XPathNodeType.Comment:
// Empty action;
break;
case XPathNodeType.All:
// Ignore the rest
break;
}
return action;
}
}
internal class TemplateLookupActionDbg : TemplateLookupAction {
internal override void Execute(Processor processor, ActionFrame frame) {
Debug.Assert(processor != null && frame != null);
Debug.Assert(frame.State == Initialized);
Debug.Assert(processor.Debugger != null);
Action action = null;
if (this.mode == Compiler.BuiltInMode) {
// mode="*" -- use one from debuggerStack
this.mode = processor.GetPrevioseMode();
Debug.Assert(this.mode != Compiler.BuiltInMode);
}
processor.SetCurrentMode(this.mode);
if (this.mode != null) {
action = importsOf == null
? processor.Stylesheet.FindTemplate(processor, frame.Node, this.mode)
: importsOf.FindTemplateImports(processor, frame.Node, this.mode);
}
else {
action = importsOf == null
? processor.Stylesheet.FindTemplate(processor, frame.Node)
: importsOf.FindTemplateImports(processor, frame.Node);
}
// Built-int template rules
if (action == null && processor.RootAction.builtInSheet != null) {
action = processor.RootAction.builtInSheet.FindTemplate(processor, frame.Node, Compiler.BuiltInMode);
}
if (action == null) {
action = BuiltInTemplate(frame.Node);
}
// Jump
if (action != null) {
frame.SetAction(action);
}
else {
frame.Finished();
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Odbc32.cs
- HostedElements.cs
- ISO2022Encoding.cs
- SaveFileDialogDesigner.cs
- ProviderConnectionPointCollection.cs
- IndentTextWriter.cs
- ScrollEventArgs.cs
- SelectionProviderWrapper.cs
- AttributeUsageAttribute.cs
- ListItemCollection.cs
- BitStack.cs
- BinaryObjectInfo.cs
- QueuePropertyVariants.cs
- WmlSelectionListAdapter.cs
- ActivityXamlServices.cs
- TraceHandlerErrorFormatter.cs
- RegexTypeEditor.cs
- MarkedHighlightComponent.cs
- ToolStripPanelRow.cs
- SafeHandle.cs
- IncrementalReadDecoders.cs
- RegexCompiler.cs
- ComEventsMethod.cs
- RuntimeWrappedException.cs
- SectionVisual.cs
- XmlSerializerFaultFormatter.cs
- CompositeDataBoundControl.cs
- ArraySet.cs
- EntryIndex.cs
- WhitespaceRuleReader.cs
- Int32RectConverter.cs
- ReaderContextStackData.cs
- ProxyWebPartManagerDesigner.cs
- TextOutput.cs
- DBConnectionString.cs
- RecognizedAudio.cs
- ConnectionProviderAttribute.cs
- Stopwatch.cs
- InstanceHandleReference.cs
- UserControlAutomationPeer.cs
- ActivityStateQuery.cs
- OutputCacheModule.cs
- ColumnMapTranslator.cs
- OutputCacheSection.cs
- EventListener.cs
- QueryContinueDragEventArgs.cs
- LoginName.cs
- CommandDevice.cs
- CacheForPrimitiveTypes.cs
- XmlExpressionDumper.cs
- WindowsRegion.cs
- HttpClientCertificate.cs
- BatchParser.cs
- BulletDecorator.cs
- DefaultSerializationProviderAttribute.cs
- EpmTargetPathSegment.cs
- BindingOperations.cs
- MobileTextWriter.cs
- PersonalizationProviderCollection.cs
- SaveFileDialog.cs
- CodeDefaultValueExpression.cs
- UntypedNullExpression.cs
- NavigationWindowAutomationPeer.cs
- RunInstallerAttribute.cs
- ThreadStaticAttribute.cs
- PolyBezierSegment.cs
- Triangle.cs
- XmlAttributeCollection.cs
- Ops.cs
- DataSysAttribute.cs
- ControlCachePolicy.cs
- HotSpot.cs
- HttpApplicationStateWrapper.cs
- XmlHierarchicalDataSourceView.cs
- WasAdminWrapper.cs
- MulticastDelegate.cs
- RegexWorker.cs
- ProcessThreadCollection.cs
- PageCache.cs
- BamlRecords.cs
- DataKeyCollection.cs
- MultiByteCodec.cs
- GetLastErrorDetailsRequest.cs
- ITextView.cs
- PrincipalPermissionMode.cs
- BatchParser.cs
- ByteConverter.cs
- HTMLTagNameToTypeMapper.cs
- DiscoveryMessageSequence.cs
- Int32CAMarshaler.cs
- UserControlCodeDomTreeGenerator.cs
- UnmanagedBitmapWrapper.cs
- TextEditorCharacters.cs
- XmlCharCheckingReader.cs
- BitConverter.cs
- DictionarySectionHandler.cs
- ResXResourceReader.cs
- AttributeCollection.cs
- RegexGroupCollection.cs
- DebugInfo.cs