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
- InputScope.cs
- DataStreamFromComStream.cs
- ContentWrapperAttribute.cs
- CompressionTracing.cs
- WebBrowserContainer.cs
- TextBoxAutoCompleteSourceConverter.cs
- ProviderException.cs
- CallbackTimeoutsElement.cs
- TrackingWorkflowEventArgs.cs
- RedirectionProxy.cs
- JournalNavigationScope.cs
- FrameworkObject.cs
- ToolBarPanel.cs
- VScrollBar.cs
- HtmlWindow.cs
- Model3D.cs
- PieceNameHelper.cs
- HighContrastHelper.cs
- PersistenceException.cs
- ProgressBarRenderer.cs
- FontSizeConverter.cs
- MethodCallTranslator.cs
- _NTAuthentication.cs
- LambdaCompiler.Address.cs
- EntityDataSourceDataSelection.cs
- ToolboxItemAttribute.cs
- Material.cs
- NamedPipeDuplicateContext.cs
- DrawingContextDrawingContextWalker.cs
- Misc.cs
- ApplicationServiceHelper.cs
- GeneralTransformGroup.cs
- ChangePassword.cs
- JavaScriptObjectDeserializer.cs
- SolidColorBrush.cs
- DrawingImage.cs
- SqlUserDefinedTypeAttribute.cs
- BamlRecords.cs
- SafeFindHandle.cs
- ResolveCompletedEventArgs.cs
- Window.cs
- MouseOverProperty.cs
- ImageKeyConverter.cs
- Transactions.cs
- MimeTypePropertyAttribute.cs
- PropertyIdentifier.cs
- ProviderCollection.cs
- SoapMessage.cs
- KeyTime.cs
- IWorkflowDebuggerService.cs
- CompositeDataBoundControl.cs
- FixedDSBuilder.cs
- InputQueue.cs
- HttpHostedTransportConfiguration.cs
- CompensationTokenData.cs
- BinarySerializer.cs
- ImportStoreException.cs
- ObjectFullSpanRewriter.cs
- TranslateTransform.cs
- RootBrowserWindow.cs
- ToolStripTextBox.cs
- Tokenizer.cs
- StylusEditingBehavior.cs
- CollectionViewProxy.cs
- ObjectToIdCache.cs
- SecureEnvironment.cs
- PageTrueTypeFont.cs
- ConditionValidator.cs
- EncryptedXml.cs
- DataGridViewRowCancelEventArgs.cs
- InvalidOleVariantTypeException.cs
- CheckBox.cs
- ErrorFormatterPage.cs
- Table.cs
- safesecurityhelperavalon.cs
- TimeSpanMinutesConverter.cs
- GeometryModel3D.cs
- EdmMember.cs
- ObjectDataSourceMethodEventArgs.cs
- NetworkInformationPermission.cs
- HttpValueCollection.cs
- _CacheStreams.cs
- WmlCalendarAdapter.cs
- webbrowsersite.cs
- Number.cs
- DescendentsWalker.cs
- StaticResourceExtension.cs
- TypeSource.cs
- SafePEFileHandle.cs
- PointConverter.cs
- GenericRootAutomationPeer.cs
- DataGridItemCollection.cs
- ControlValuePropertyAttribute.cs
- XamlPointCollectionSerializer.cs
- Int16AnimationBase.cs
- InvalidWMPVersionException.cs
- BindingNavigator.cs
- LicenseProviderAttribute.cs
- ChtmlTextWriter.cs
- AttributeCollection.cs