Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- MultipleViewProviderWrapper.cs
- ToolStripContentPanelDesigner.cs
- MSAANativeProvider.cs
- SafePEFileHandle.cs
- Interop.cs
- HijriCalendar.cs
- HttpHandler.cs
- OverlappedContext.cs
- EnumBuilder.cs
- CompiledXpathExpr.cs
- InkCanvasAutomationPeer.cs
- BindingWorker.cs
- ImportOptions.cs
- OutputWindow.cs
- CounterSampleCalculator.cs
- RoleService.cs
- baseaxisquery.cs
- SamlNameIdentifierClaimResource.cs
- FormatConvertedBitmap.cs
- PublisherMembershipCondition.cs
- RichTextBoxConstants.cs
- ForEachDesigner.xaml.cs
- HtmlContainerControl.cs
- BitmapSource.cs
- TableLayoutSettingsTypeConverter.cs
- Socket.cs
- IPAddress.cs
- RectangleHotSpot.cs
- CodeSubDirectory.cs
- AnnouncementDispatcherAsyncResult.cs
- DateRangeEvent.cs
- ReferenceConverter.cs
- ControlAdapter.cs
- InvalidDataContractException.cs
- IndependentAnimationStorage.cs
- _ScatterGatherBuffers.cs
- AnnotationDocumentPaginator.cs
- XmlImplementation.cs
- ApplicationDirectory.cs
- ImageListImage.cs
- HttpRequest.cs
- Form.cs
- EventProviderWriter.cs
- ConfigurationConverterBase.cs
- FieldNameLookup.cs
- CancelEventArgs.cs
- ExclusiveNamedPipeTransportManager.cs
- HtmlTableCellCollection.cs
- GAC.cs
- DataRowView.cs
- TypeKeyValue.cs
- StackSpiller.Temps.cs
- HttpServerUtilityWrapper.cs
- IPEndPointCollection.cs
- ISessionStateStore.cs
- StatusBarPanel.cs
- SQLBoolean.cs
- XsltLoader.cs
- Image.cs
- InvocationExpression.cs
- LinqExpressionNormalizer.cs
- DNS.cs
- ComplexType.cs
- AcceptorSessionSymmetricTransportSecurityProtocol.cs
- TabletDeviceInfo.cs
- AnimationClock.cs
- SignatureDescription.cs
- LocatorManager.cs
- Line.cs
- WebScriptMetadataFormatter.cs
- MissingManifestResourceException.cs
- PrintController.cs
- LayoutInformation.cs
- TCEAdapterGenerator.cs
- TemplatedMailWebEventProvider.cs
- CodeDOMUtility.cs
- FrameworkElementAutomationPeer.cs
- InfiniteIntConverter.cs
- MessageSmuggler.cs
- RadioButtonAutomationPeer.cs
- CodeDomComponentSerializationService.cs
- AdornerHitTestResult.cs
- XamlReaderConstants.cs
- GiveFeedbackEventArgs.cs
- DetailsViewUpdateEventArgs.cs
- DbConnectionInternal.cs
- TreeNodeBinding.cs
- PackagingUtilities.cs
- ConfigurationException.cs
- HeaderedContentControl.cs
- LocationSectionRecord.cs
- Enum.cs
- GeneralTransform3D.cs
- _ProxyChain.cs
- ContextDataSourceView.cs
- Screen.cs
- PeerSecurityHelpers.cs
- HotSpot.cs
- ConfigurationStrings.cs
- Unit.cs