本文整理汇总了C#中System.Xml.Xsl.XsltContext类的典型用法代码示例。如果您正苦于以下问题:C# XsltContext类的具体用法?C# XsltContext怎么用?C# XsltContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XsltContext类属于System.Xml.Xsl命名空间,在下文中一共展示了XsltContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetXsltContext
internal override void SetXsltContext(XsltContext context){
System.Diagnostics.Debug.Assert(context != null);
m_URN = context.LookupNamespace(m_Prefix);
if (m_qyInput != null)
m_qyInput.SetXsltContext(context);
}
示例2: XPathParser
internal XPathParser(string xpath, XmlNamespaceManager namespaces, IFunctionLibrary[] functionLibraries)
{
this.functionLibraries = functionLibraries;
this.namespaces = namespaces;
this.lexer = new XPathLexer(xpath);
this.context = namespaces as XsltContext;
}
示例3: SetXsltContext
public override void SetXsltContext(XsltContext context)
{
if (this.arg != null)
{
this.arg.SetXsltContext(context);
}
}
示例4: XsltFunctionCallOpcode
// REFACTOR, [....], make this a function on QueryValueModel
internal XsltFunctionCallOpcode(XsltContext context, IXsltContextFunction function, int argCount)
: base(OpcodeID.XsltFunction)
{
Fx.Assert(null != context && null != function, "");
this.xsltContext = context;
this.function = function;
this.argCount = argCount;
for (int i = 0; i < function.Maxargs; ++i)
{
if (function.ArgTypes[i] == XPathResultType.NodeSet)
{
this.iterList = new List<NodeSequenceIterator>();
break;
}
}
// Make sure the return type is valid
switch (this.function.ReturnType)
{
case XPathResultType.String:
case XPathResultType.Number:
case XPathResultType.Boolean:
case XPathResultType.NodeSet:
break;
default:
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new QueryCompileException(QueryCompileError.InvalidType, SR.GetString(SR.QueryFunctionTypeNotSupported, this.function.ReturnType.ToString())));
}
}
示例5: SetXsltContext
public override void SetXsltContext(XsltContext context)
{
if (context == null)
{
throw XPathException.Create(SR.Xp_NoContext);
}
if (this.xsltContext != context)
{
xsltContext = context;
foreach (Query argument in _args)
{
argument.SetXsltContext(context);
}
XPathResultType[] argTypes = new XPathResultType[_args.Count];
for (int i = 0; i < _args.Count; i++)
{
argTypes[i] = _args[i].StaticType;
}
_function = xsltContext.ResolveFunction(prefix, name, argTypes);
// KB article allows to return null, see http://support.microsoft.com/?kbid=324462#6
if (_function == null)
{
throw XPathException.Create(SR.Xp_UndefFunc, QName);
}
}
}
示例6: XsltDebuggerContext
public XsltDebuggerContext (XsltDebuggerSession session, XPathNodeIterator currentNodeset, XPathNavigator stylesheetElement, XsltContext xsltContext)
{
this.session = session;
this.nodes = currentNodeset;
this.style = stylesheetElement;
this.xsltctx = xsltContext;
}
示例7: SetContext
public void SetContext(XsltContext context)
{
path.SetContext(context);
if (firstStep != null)
firstStep.SetContext(context);
}
示例8: Invoke
public object Invoke(XsltContext xsltContext, object[] args, XPathNavigator docContext) {
bool result = false;
try {
Navigator nav = null;
string toTypeName = null;
if (args.Length == 2) {
XPathNodeIterator it = (XPathNodeIterator)args[0];
if (it.MoveNext()) {
toTypeName = (string)args[1];
nav = (Navigator)it.Current;
}
} else {
toTypeName = (string)args[0];
nav = (Navigator)docContext;
}
if (nav.Current is Mono.Cecil.TypeReference) {
Mono.Cecil.TypeReference reference = (Mono.Cecil.TypeReference)nav.Current;
Type fromType = Type.GetType(reference.FullName);
Type toType = Type.GetType(toTypeName);
if (fromType != null && toType != null)
result = toType.IsAssignableFrom(fromType);
}
} catch (Exception e) {
Console.WriteLine("CanCastTo function failed : \n" + e);
}
return result;
}
示例9: Invoke
/// <summary>
/// Provides the method to invoke the function with the given arguments in the given context.
/// </summary>
/// <returns>
/// An <see cref="T:System.Object"/> representing the return value of the function.
/// </returns>
/// <param name="xsltContext">
/// The XSLT context for the function call.
/// </param>
/// <param name="args">
/// The arguments of the function call. Each argument is an element in the array.
/// </param>
/// <param name="docContext">
/// The context node for the function call.
/// </param>
public object Invoke(XsltContext xsltContext, object[] args, XPathNavigator docContext)
{
string sep = Template.ResultToString(args[1]);
XPathNodeIterator nodeIter = (XPathNodeIterator)args[0];
string ret = string.Join(sep, nodeIter.Cast<XPathNavigator>().Select(n => n.ToString()));
return ret;
}
示例10: Invoke
public object Invoke(XsltContext xsltContext, object[] args, XPathNavigator docContext)
{
switch (function)
{
case "document":
string url = args.Any() ? (string) args[0] : string.Empty;
if (string.IsNullOrWhiteSpace(url)) // When document('') targeting local xsl
{
throw new ArgumentException("url");
//var secondNavigator = docContext.Clone();
//secondNavigator.MoveToRoot();
//return secondNavigator.Select(".");
}
// When Url is supplied in document(url)
XDocument xDoc =
XDocument.Load(Directory.GetCurrentDirectory() + "/SchematronFiles/" + (string) args[0]);
XElement rootElement = xDoc.XPathSelectElement("/*");
return rootElement.CreateNavigator().Select(".");
}
return null;
}
示例11: Invoke
public virtual object Invoke(XsltContext xsltContext, object[] args, System.Xml.XPath.XPathNavigator docContext)
{
if (Function != null)
return Function(xsltContext, args, docContext);
else
throw new NotImplementedException("Custom function not implemented. Supply a lamba, or override Invoke()");
}
示例12: SetXsltContext
public override void SetXsltContext(XsltContext context)
{
for (int i = 0; i < _argList.Count; i++)
{
_argList[i].SetXsltContext(context);
}
}
示例13: Evaluate
public object Evaluate(XsltContext xsltContext){
object val = null;
if (tr != null)
val = tr.GetParameter(name);
else
val = ext.GetType().GetProperty(name).GetValue(ext, null);
return val == null ? "" : val;
}
示例14: Invoke
public override object Invoke(XsltContext xsltContext, object[] args, XPathNavigator docContext)
{
string str = XPathMessageFunction.ToString(args[0]);
string xpath = string.Format(CultureInfo.InvariantCulture, "/s11:Envelope/s11:Header/*[@s11:actor='{0}'] | /s12:Envelope/s12:Header/*[@s12:role='{1}']", new object[] { str, str });
XPathExpression expr = docContext.Compile(xpath);
expr.SetContext((XmlNamespaceManager) xsltContext);
return docContext.Evaluate(expr);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:XPathMessageFunctionHeadersWithActor.cs
示例15: SetXsltContext
public override void SetXsltContext(XsltContext context)
{
_xsltContext = context.Whitespace ? context : null;
if (_arg != null)
{
_arg.SetXsltContext(context);
}
}