XsltContext.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // System.Xml.Xsl.XsltContext
  2. //
  3. // Author: Tim Coleman <[email protected]>
  4. // (C) Copyright 2002 Tim Coleman
  5. //
  6. // Permission is hereby granted, free of charge, to any person obtaining
  7. // a copy of this software and associated documentation files (the
  8. // "Software"), to deal in the Software without restriction, including
  9. // without limitation the rights to use, copy, modify, merge, publish,
  10. // distribute, sublicense, and/or sell copies of the Software, and to
  11. // permit persons to whom the Software is furnished to do so, subject to
  12. // the following conditions:
  13. //
  14. // The above copyright notice and this permission notice shall be
  15. // included in all copies or substantial portions of the Software.
  16. //
  17. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  20. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  21. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  22. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  23. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. //
  25. using System;
  26. using System.Xml;
  27. using System.Xml.XPath;
  28. namespace System.Xml.Xsl
  29. {
  30. public abstract class XsltContext : XmlNamespaceManager
  31. {
  32. #region Constructors
  33. public XsltContext ()
  34. : base (new NameTable ())
  35. {
  36. }
  37. public XsltContext (NameTable table)
  38. : base (table)
  39. {
  40. }
  41. #endregion
  42. #region Properties
  43. public abstract bool Whitespace { get; }
  44. public abstract bool PreserveWhitespace (XPathNavigator nav);
  45. #endregion
  46. #region Methods
  47. public abstract int CompareDocument (string baseUri, string nextbaseUri);
  48. public abstract IXsltContextFunction ResolveFunction (string prefix, string name, XPathResultType [] ArgTypes);
  49. public abstract IXsltContextVariable ResolveVariable (string prefix, string name);
  50. #endregion
  51. #region XSLT Internal Calls
  52. internal virtual IXsltContextVariable ResolveVariable (XmlQualifiedName name)
  53. {
  54. throw new InvalidOperationException ("somehow you got into the internals of xslt!?");
  55. }
  56. internal virtual IXsltContextFunction ResolveFunction (XmlQualifiedName name, XPathResultType [] ArgTypes)
  57. {
  58. throw new InvalidOperationException ("somehow you got into the internals of xslt!?");
  59. }
  60. #endregion
  61. }
  62. // The static XSLT context, will try to simplify what it can
  63. internal interface IStaticXsltContext
  64. {
  65. Expression TryGetVariable (string nm);
  66. Expression TryGetFunction (XmlQualifiedName nm, FunctionArguments args);
  67. XmlQualifiedName LookupQName (string s);
  68. string LookupNamespace (string prefix);
  69. }
  70. }