Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / TemplateLookupAction.cs / 1305376 / 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
- StringUtil.cs
- MenuItem.cs
- MachineKey.cs
- LicenseProviderAttribute.cs
- QueryableDataSourceView.cs
- DataKeyCollection.cs
- ByteAnimationUsingKeyFrames.cs
- EnvironmentPermission.cs
- ItemsPanelTemplate.cs
- GridViewRowPresenterBase.cs
- ColorAnimationBase.cs
- ThemeDictionaryExtension.cs
- UrlMappingsModule.cs
- InstallerTypeAttribute.cs
- ReadOnlyDictionary.cs
- CollectionViewSource.cs
- Matrix3DConverter.cs
- SqlDataSource.cs
- EventLogHandle.cs
- RequestCacheManager.cs
- MarkupObject.cs
- PropertyRef.cs
- IsolationInterop.cs
- ScriptManagerProxy.cs
- GeometryModel3D.cs
- ListViewItemMouseHoverEvent.cs
- ObjectViewEntityCollectionData.cs
- BitSet.cs
- DataGridViewCellValueEventArgs.cs
- WhitespaceReader.cs
- InputElement.cs
- VsPropertyGrid.cs
- MemberProjectionIndex.cs
- RedirectionProxy.cs
- shaperfactory.cs
- ToolboxBitmapAttribute.cs
- SerializerDescriptor.cs
- Region.cs
- PresentationAppDomainManager.cs
- ServiceModelConfigurationElementCollection.cs
- BasicExpandProvider.cs
- StyleSheet.cs
- UnsafeNativeMethods.cs
- CommandEventArgs.cs
- TypeBuilderInstantiation.cs
- SqlClientWrapperSmiStreamChars.cs
- ProxyFragment.cs
- SecurityContextCookieSerializer.cs
- Aes.cs
- HttpContext.cs
- MyContact.cs
- DetailsViewModeEventArgs.cs
- ProgressPage.cs
- ConfigXmlAttribute.cs
- CompilationRelaxations.cs
- TypeToStringValueConverter.cs
- MetafileHeaderWmf.cs
- DataGridColumnHeader.cs
- HealthMonitoringSectionHelper.cs
- SaveFileDialog.cs
- GlobalProxySelection.cs
- Calendar.cs
- WrapperEqualityComparer.cs
- XmlSchemaObject.cs
- ClientScriptManagerWrapper.cs
- PageStatePersister.cs
- StaticTextPointer.cs
- SBCSCodePageEncoding.cs
- CodeObject.cs
- XAMLParseException.cs
- BinaryConverter.cs
- BindingMAnagerBase.cs
- Socket.cs
- Identity.cs
- AppSettingsExpressionBuilder.cs
- KeyValuePairs.cs
- SimpleBitVector32.cs
- DataGrid.cs
- RegexCode.cs
- ExpressionBuilder.cs
- GeneralTransform3DTo2DTo3D.cs
- XPathSingletonIterator.cs
- ScrollData.cs
- MimeTypePropertyAttribute.cs
- HTMLTextWriter.cs
- FacetChecker.cs
- x509store.cs
- RestHandler.cs
- DataList.cs
- DesignerCommandSet.cs
- CharConverter.cs
- XsltException.cs
- Parallel.cs
- XmlSchema.cs
- UnknownBitmapEncoder.cs
- DataListComponentEditor.cs
- TypeBuilderInstantiation.cs
- CommonRemoteMemoryBlock.cs
- DatagramAdapter.cs
- XmlMapping.cs