Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CommandID.cs
- TitleStyle.cs
- RouteValueExpressionBuilder.cs
- SqlGatherConsumedAliases.cs
- DefinitionBase.cs
- ToolStripSplitButton.cs
- RawTextInputReport.cs
- DependencyProperty.cs
- GZipStream.cs
- COM2ExtendedUITypeEditor.cs
- DoubleKeyFrameCollection.cs
- basemetadatamappingvisitor.cs
- WinEventQueueItem.cs
- NonceCache.cs
- BindingExpressionBase.cs
- SqlClientWrapperSmiStream.cs
- StylusPoint.cs
- AbstractDataSvcMapFileLoader.cs
- String.cs
- MaterialGroup.cs
- RegionIterator.cs
- XmlSchemaExternal.cs
- ProfilePropertySettingsCollection.cs
- XmlName.cs
- DesignerActionUI.cs
- Scene3D.cs
- ServiceContractGenerationContext.cs
- EditorZoneBase.cs
- ValueType.cs
- SimpleMailWebEventProvider.cs
- ClientApiGenerator.cs
- RecommendedAsConfigurableAttribute.cs
- TableItemPattern.cs
- SupportingTokenAuthenticatorSpecification.cs
- ControlIdConverter.cs
- RowToFieldTransformer.cs
- TreeIterator.cs
- DataServiceResponse.cs
- Int32Storage.cs
- Blend.cs
- FileDialog.cs
- Font.cs
- M3DUtil.cs
- UrlPath.cs
- DataBindingCollectionConverter.cs
- CalloutQueueItem.cs
- ProfileService.cs
- PartManifestEntry.cs
- Int64Converter.cs
- DocumentViewerAutomationPeer.cs
- Site.cs
- TableParaClient.cs
- ProtocolViolationException.cs
- MarkupWriter.cs
- ResourceLoader.cs
- ClipboardProcessor.cs
- COMException.cs
- DPCustomTypeDescriptor.cs
- VisualStyleInformation.cs
- EdmScalarPropertyAttribute.cs
- AppliedDeviceFiltersEditor.cs
- FileLevelControlBuilderAttribute.cs
- ImageFormatConverter.cs
- OutputCacheSettingsSection.cs
- ScriptingJsonSerializationSection.cs
- CodeTypeParameterCollection.cs
- PanelDesigner.cs
- KeyEventArgs.cs
- ResponseBodyWriter.cs
- HttpConfigurationSystem.cs
- TableSectionStyle.cs
- SizeConverter.cs
- CultureInfo.cs
- MatrixTransform.cs
- BitmapMetadata.cs
- SafeNativeMethods.cs
- WorkflowOperationErrorHandler.cs
- DynamicDocumentPaginator.cs
- SynchronizedChannelCollection.cs
- ThemeConfigurationDialog.cs
- CustomAttributeSerializer.cs
- TextTreeExtractElementUndoUnit.cs
- WizardStepBase.cs
- ComponentDesigner.cs
- ValueType.cs
- SimpleType.cs
- AuthenticationModuleElementCollection.cs
- ImageEditor.cs
- StorageEntitySetMapping.cs
- EventMappingSettingsCollection.cs
- TCEAdapterGenerator.cs
- SudsParser.cs
- DataTransferEventArgs.cs
- CompositeFontParser.cs
- DesignerActionHeaderItem.cs
- DocumentXPathNavigator.cs
- WindowClosedEventArgs.cs
- MruCache.cs
- ContractMapping.cs
- StylusLogic.cs