You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(174) |
Nov
(85) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(56) |
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
(1) |
Jul
(132) |
Aug
(5) |
Sep
|
Oct
(314) |
Nov
(133) |
Dec
(18) |
2006 |
Jan
(6) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Update of /cvsroot/mvp-xml/EXSLT/v1/src/Exslt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15352/v1/src/Exslt Modified Files: AssemblyInfo.cs Exslt.csproj ExsltContext.cs ExsltMath.cs ExsltNamespaces.cs ExsltNodeList.cs ExsltSets.cs ExsltTransform.cs Log Message: Index: ExsltNamespaces.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v1/src/Exslt/ExsltNamespaces.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ExsltNamespaces.cs 15 Oct 2005 22:11:16 -0000 1.2 +++ ExsltNamespaces.cs 22 Oct 2005 21:18:07 -0000 1.3 @@ -2,7 +2,8 @@ /// <summary> /// Exslt (and other) namespaces constants. /// </summary> - public class ExsltNamespaces { + public class ExsltNamespaces { + public const string Common = "http://exslt.org/common"; public const string DatesAndTimes = "http://exslt.org/dates-and-times"; public const string Math = "http://exslt.org/math"; public const string Random = "http://exslt.org/random"; Index: ExsltMath.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v1/src/Exslt/ExsltMath.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ExsltMath.cs 15 Oct 2005 22:11:16 -0000 1.2 +++ ExsltMath.cs 22 Oct 2005 21:18:07 -0000 1.3 @@ -3,7 +3,6 @@ using System; using System.Xml; using System.Xml.XPath; -using System.Collections.Generic; #endregion @@ -130,11 +129,11 @@ /// <returns>All the nodes that contain the min value in the nodeset</returns> public XPathNodeIterator lowest(XPathNodeIterator iterator){ - IList<XPathNavigator> newList = new List<XPathNavigator>(); + ExsltNodeList newList = new ExsltNodeList(); double min, t; if(iterator.Count == 0){ - return newList; + return ExsltCommon.ExsltNodeListToXPathNodeIterator(newList); } Index: ExsltNodeList.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v1/src/Exslt/ExsltNodeList.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ExsltNodeList.cs 15 Oct 2005 22:11:16 -0000 1.2 +++ ExsltNodeList.cs 22 Oct 2005 21:18:07 -0000 1.3 @@ -1,7 +1,7 @@ #region using using System; -using System.Collections.Generic; +using System.Collections; using System.Xml.XPath; #endregion @@ -19,7 +19,7 @@ /// <summary> /// The inner arraylist used by this class. /// </summary> - internal IList<XPathNavigator> innerList = new List<XPathNavigator>(); + internal ArrayList innerList = new ArrayList(); #endregion @@ -52,7 +52,7 @@ /// in the iterator are placed in the list. /// </summary> /// <param name="iterator">The iterator to load the nodelist from</param> - public ExsltNodeList(XPathNodeIterator iterator): this(iterator, false) {} + public ExsltNodeList(XPathNodeIterator iterator): this(iterator, false){;} @@ -91,17 +91,18 @@ /// Returns an enumerator for the entire list. /// </summary> /// <returns>An enumerator for the entire list</returns> - public IEnumerator<XPathNavigator> GetEnumerator(){ + public IEnumerator GetEnumerator(){ return this.innerList.GetEnumerator(); } /// <summary> /// Adds an item to the list /// </summary> - /// <param name="value">The item to add</param> - public void Add( XPathNavigator nav){ + /// <param name="value">The item to add</param> + /// <returns>The position into which the new element was inserted</returns> + public int Add( XPathNavigator nav){ - this.innerList.Add(nav); + return this.innerList.Add(nav); } @@ -152,7 +153,7 @@ /// <returns>The index of value if found in the list; otherwise, -1.</returns> public int IndexOf( object value ){ - return this.innerList.IndexOf(value as XPathNavigator); + return this.innerList.IndexOf(value); } /// <summary> Index: Exslt.csproj =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v1/src/Exslt/Exslt.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Exslt.csproj 15 Oct 2005 21:24:17 -0000 1.3 +++ Exslt.csproj 22 Oct 2005 21:18:07 -0000 1.4 @@ -1,163 +1,214 @@ -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <ProjectType>Local</ProjectType> - <ProductVersion>8.0.50215</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{BA694D9F-6B1E-4038-AC81-BF1640C07D90}</ProjectGuid> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ApplicationIcon> - </ApplicationIcon> - <AssemblyKeyContainerName> - </AssemblyKeyContainerName> - <AssemblyName>Mvp.Xml.Exslt</AssemblyName> - <AssemblyOriginatorKeyFile> - </AssemblyOriginatorKeyFile> - <DefaultClientScript>JScript</DefaultClientScript> - <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> - <DefaultTargetSchema>IE50</DefaultTargetSchema> - <DelaySign>false</DelaySign> - <OutputType>Library</OutputType> - <RootNamespace>Mvp.Xml.Exslt</RootNamespace> - <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> - <StartupObject> - </StartupObject> - <FileUpgradeFlags> - </FileUpgradeFlags> - <UpgradeBackupLocation> - </UpgradeBackupLocation> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <OutputPath>.\</OutputPath> - <AllowUnsafeBlocks>false</AllowUnsafeBlocks> - <BaseAddress>285212672</BaseAddress> - <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> - <ConfigurationOverrideFile> - </ConfigurationOverrideFile> - <DefineConstants>DEBUG;TRACE;NET11</DefineConstants> - <DocumentationFile> - </DocumentationFile> - <DebugSymbols>true</DebugSymbols> - <FileAlignment>4096</FileAlignment> - <NoStdLib>false</NoStdLib> - <NoWarn> - </NoWarn> - <Optimize>false</Optimize> - <RegisterForComInterop>false</RegisterForComInterop> - <RemoveIntegerChecks>false</RemoveIntegerChecks> - <TreatWarningsAsErrors>false</TreatWarningsAsErrors> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <OutputPath>.\</OutputPath> - <AllowUnsafeBlocks>false</AllowUnsafeBlocks> - <BaseAddress>285212672</BaseAddress> - <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> - <ConfigurationOverrideFile> - </ConfigurationOverrideFile> - <DefineConstants>TRACE;NET11</DefineConstants> - <DocumentationFile> - </DocumentationFile> - <DebugSymbols>false</DebugSymbols> - <FileAlignment>4096</FileAlignment> - <NoStdLib>false</NoStdLib> - <NoWarn> - </NoWarn> - <Optimize>true</Optimize> - <RegisterForComInterop>false</RegisterForComInterop> - <RemoveIntegerChecks>false</RemoveIntegerChecks> - <TreatWarningsAsErrors>false</TreatWarningsAsErrors> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="System"> - <Name>System</Name> - </Reference> - <Reference Include="System.Data"> - <Name>System.Data</Name> - </Reference> - <Reference Include="System.Drawing"> - <Name>System.Drawing</Name> - </Reference> - <Reference Include="System.Web"> - <Name>System.Web</Name> - </Reference> - <Reference Include="System.Windows.Forms"> - <Name>System.Windows.Forms</Name> - </Reference> - <Reference Include="System.Xml"> - <Name>System.XML</Name> - </Reference> - </ItemGroup> - <ItemGroup> - <Compile Include="AssemblyInfo.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="ExsltContext.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="ExsltContextFunction.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="ExsltDatesAndTimes.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="ExsltMath.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="ExsltNamespaces.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="ExsltNodeList.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="ExsltRandom.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="ExsltRegularExpressions.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="ExsltSets.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="ExsltStrings.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="ExsltTransform.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="GDNDatesAndTimes.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="GDNDynamic.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="GDNMath.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="GDNRegularExpressions.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="GDNSets.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="GDNStrings.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="MultiOutput\MultiXmlTextWriter.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="MultiOutput\OutputState.cs"> - <SubType>Code</SubType> - </Compile> - <Content Include="Makefile" /> - </ItemGroup> - <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> - <PropertyGroup> - <PreBuildEvent> - </PreBuildEvent> - <PostBuildEvent>@echo ########### Setting environment variables -call "$(DevEnvDir)..\Tools\vsvars32.bat" -nmake</PostBuildEvent> - </PropertyGroup> -</Project> \ No newline at end of file +<VisualStudioProject> + <CSHARP + ProjectType = "Local" + ProductVersion = "7.10.3077" + SchemaVersion = "2.0" + ProjectGuid = "{BA694D9F-6B1E-4038-AC81-BF1640C07D90}" + > + <Build> + <Settings + ApplicationIcon = "" + AssemblyKeyContainerName = "" + AssemblyName = "Mvp.Xml.Exslt" + AssemblyOriginatorKeyFile = "" + DefaultClientScript = "JScript" + DefaultHTMLPageLayout = "Grid" + DefaultTargetSchema = "IE50" + DelaySign = "false" + OutputType = "Library" + PreBuildEvent = "" + PostBuildEvent = '@echo ########### Setting environment variables
call "$(DevEnvDir)..\Tools\vsvars32.bat"
nmake' + RootNamespace = "Mvp.Xml.Exslt" + RunPostBuildEvent = "OnBuildSuccess" + StartupObject = "" + > + <Config + Name = "Debug" + AllowUnsafeBlocks = "false" + BaseAddress = "285212672" + CheckForOverflowUnderflow = "false" + ConfigurationOverrideFile = "" + DefineConstants = "DEBUG;TRACE;NET11" + DocumentationFile = "" + DebugSymbols = "true" + FileAlignment = "4096" + IncrementalBuild = "true" + NoStdLib = "false" + NoWarn = "" + Optimize = "false" + OutputPath = ".\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "4" + /> + <Config + Name = "Release" + AllowUnsafeBlocks = "false" + BaseAddress = "285212672" + CheckForOverflowUnderflow = "false" + ConfigurationOverrideFile = "" + DefineConstants = "TRACE;NET11" + DocumentationFile = "" + DebugSymbols = "false" + FileAlignment = "4096" + IncrementalBuild = "false" + NoStdLib = "false" + NoWarn = "" + Optimize = "true" + OutputPath = ".\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "4" + /> + </Settings> + <References> + <Reference + Name = "System" + AssemblyName = "System" + HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll" + /> + <Reference + Name = "System.Data" + AssemblyName = "System.Data" + HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll" + /> + <Reference + Name = "System.XML" + AssemblyName = "System.Xml" + HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" + /> + <Reference + Name = "System.Drawing" + AssemblyName = "System.Drawing" + HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll" + /> + <Reference + Name = "System.Windows.Forms" + AssemblyName = "System.Windows.Forms" + HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll" + /> + <Reference + Name = "System.Web" + AssemblyName = "System.Web" + HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Web.dll" + /> + </References> + </Build> + <Files> + <Include> + <File + RelPath = "AssemblyInfo.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ExsltCommon.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ExsltContext.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ExsltContextFunction.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ExsltDatesAndTimes.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ExsltMath.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ExsltNamespaces.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ExsltNodeList.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ExsltRandom.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ExsltRegularExpressions.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ExsltSets.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ExsltStrings.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ExsltTransform.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "GDNDatesAndTimes.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "GDNDynamic.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "GDNMath.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "GDNRegularExpressions.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "GDNSets.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "GDNStrings.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Makefile" + BuildAction = "Content" + /> + <File + RelPath = "MultiOutput\MultiXmlTextWriter.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "MultiOutput\OutputState.cs" + SubType = "Code" + BuildAction = "Compile" + /> + </Include> + </Files> + </CSHARP> +</VisualStudioProject> + Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v1/src/Exslt/AssemblyInfo.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- AssemblyInfo.cs 15 Oct 2005 21:24:17 -0000 1.2 +++ AssemblyInfo.cs 22 Oct 2005 21:18:07 -0000 1.3 @@ -32,7 +32,7 @@ // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("2.0.*")] +[assembly: AssemblyVersion("1.3.*")] // // In order to sign your assembly you must specify a key to use. Refer to the Index: ExsltTransform.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v1/src/Exslt/ExsltTransform.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ExsltTransform.cs 15 Oct 2005 22:11:16 -0000 1.4 +++ ExsltTransform.cs 22 Oct 2005 21:18:07 -0000 1.5 @@ -73,13 +73,18 @@ /// <summary> /// The XslTransform object wrapped by this class. /// </summary> - private XslCompiledTransform xslTransform; + private XslTransform xslTransform; /// <summary> /// Bitwise enumeration used to specify which EXSLT functions should be accessible to /// the ExsltTransform object. The default value is ExsltFunctionNamespace.All /// </summary> - private ExsltFunctionNamespace _supportedFunctions = ExsltFunctionNamespace.All; + private ExsltFunctionNamespace _supportedFunctions = ExsltFunctionNamespace.All; + + /// <summary> + /// Extension object which implements the functions in the http://exslt.org/common namespace + /// </summary> + private ExsltCommon exsltCommon = new ExsltCommon(); /// <summary> /// Extension object which implements the functions in the http://exslt.org/math namespace @@ -189,7 +194,7 @@ /// Constructor initializes class. /// </summary> public ExsltTransform(){ - this.xslTransform = new XslCompiledTransform(); + this.xslTransform = new XslTransform(); } #endregion Index: ExsltContext.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v1/src/Exslt/ExsltContext.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ExsltContext.cs 15 Oct 2005 22:11:16 -0000 1.3 +++ ExsltContext.cs 22 Oct 2005 21:18:07 -0000 1.4 @@ -24,7 +24,12 @@ /// Bitwise enumeration used to specify which EXSLT functions should be accessible to /// in the ExsltContext object. The default value is ExsltFunctionNamespace.All /// </summary> - private ExsltFunctionNamespace _supportedFunctions = ExsltFunctionNamespace.All; + private ExsltFunctionNamespace _supportedFunctions = ExsltFunctionNamespace.All; + + /// <summary> + /// Extension object which implements the functions in the http://exslt.org/common namespace + /// </summary> + private ExsltCommon exsltCommon = new ExsltCommon(); /// <summary> /// Extension object which implements the functions in the http://exslt.org/math namespace @@ -102,63 +107,68 @@ } #endregion - - #region Private methods - private void AddExtensionNamespaces() - { - //remove all our extension objects in case the ExsltContext is being reused - RemoveNamespace("math", ExsltNamespaces.Math); - RemoveNamespace("date", ExsltNamespaces.DatesAndTimes); - RemoveNamespace("regexp", ExsltNamespaces.RegularExpressions); + + private void AddExtensionNamespaces() { + //remove all our extension objects in case the ExsltContext is being reused + RemoveNamespace("exsl", ExsltNamespaces.Common); + RemoveNamespace("math", ExsltNamespaces.Math); + RemoveNamespace("date", ExsltNamespaces.DatesAndTimes); + RemoveNamespace("regexp", ExsltNamespaces.RegularExpressions); RemoveNamespace("str", ExsltNamespaces.Strings); - RemoveNamespace("set", ExsltNamespaces.Sets); - RemoveNamespace("random", ExsltNamespaces.Random); + RemoveNamespace("set", ExsltNamespaces.Sets); + RemoveNamespace("random", ExsltNamespaces.Random); RemoveNamespace("date2", ExsltNamespaces.GDNDatesAndTimes); RemoveNamespace("math2", ExsltNamespaces.GDNMath); RemoveNamespace("regexp2", ExsltNamespaces.GDNRegularExpressions); RemoveNamespace("set2", ExsltNamespaces.GDNSets); RemoveNamespace("str2", ExsltNamespaces.GDNStrings); RemoveNamespace("dyn2", ExsltNamespaces.GDNDynamic); + + //add extension objects as specified by SupportedFunctions + if((this.SupportedFunctions & ExsltFunctionNamespace.Common) > 0) + AddNamespace("exsl", ExsltNamespaces.Common); - //add extension objects as specified by SupportedFunctions - if ((this.SupportedFunctions & ExsltFunctionNamespace.Math) > 0) + if((this.SupportedFunctions & ExsltFunctionNamespace.Math) > 0) AddNamespace("math", ExsltNamespaces.Math); - if ((this.SupportedFunctions & ExsltFunctionNamespace.DatesAndTimes) > 0) + if((this.SupportedFunctions & ExsltFunctionNamespace.DatesAndTimes) > 0) AddNamespace("date", ExsltNamespaces.DatesAndTimes); - if ((this.SupportedFunctions & ExsltFunctionNamespace.RegularExpressions) > 0) + if((this.SupportedFunctions & ExsltFunctionNamespace.RegularExpressions) > 0) AddNamespace("regexp", ExsltNamespaces.RegularExpressions); - if ((this.SupportedFunctions & ExsltFunctionNamespace.Strings) > 0) + if((this.SupportedFunctions & ExsltFunctionNamespace.Strings) > 0) AddNamespace("str", ExsltNamespaces.Strings); - if ((this.SupportedFunctions & ExsltFunctionNamespace.Sets) > 0) + if((this.SupportedFunctions & ExsltFunctionNamespace.Sets) > 0) AddNamespace("set", ExsltNamespaces.Sets); - if ((this.SupportedFunctions & ExsltFunctionNamespace.Random) > 0) + if((this.SupportedFunctions & ExsltFunctionNamespace.Random) > 0) AddNamespace("random", ExsltNamespaces.Random); - - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNDatesAndTimes) > 0) + + if((this.SupportedFunctions & ExsltFunctionNamespace.GDNDatesAndTimes) > 0) AddNamespace("date2", ExsltNamespaces.GDNDatesAndTimes); - - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNMath) > 0) + + if((this.SupportedFunctions & ExsltFunctionNamespace.GDNMath) > 0) AddNamespace("math2", ExsltNamespaces.GDNMath); - - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNRegularExpressions) > 0) + + if((this.SupportedFunctions & ExsltFunctionNamespace.GDNRegularExpressions) > 0) AddNamespace("regexp2", ExsltNamespaces.GDNRegularExpressions); - - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNSets) > 0) + + if((this.SupportedFunctions & ExsltFunctionNamespace.GDNSets) > 0) AddNamespace("set2", ExsltNamespaces.GDNSets); + + if((this.SupportedFunctions & ExsltFunctionNamespace.GDNStrings) > 0) + AddNamespace("str2", ExsltNamespaces.GDNStrings); - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNStrings) > 0) - AddNamespace("str2", ExsltNamespaces.GDNStrings); - - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNDynamic) > 0) - AddNamespace("dyn2", ExsltNamespaces.GDNDynamic); - } - #endregion - + if((this.SupportedFunctions & ExsltFunctionNamespace.GDNDynamic) > 0) + AddNamespace("dyn2", ExsltNamespaces.GDNDynamic); + } + + public override int CompareDocument(string baseUri, string nextbaseUri) { + return 0; + } + #region Public Properties /// <summary> /// Bitwise enumeration used to specify which EXSLT functions should be accessible to @@ -172,78 +182,69 @@ get { return _supportedFunctions; } } #endregion - - #region XsltContext Overrides - public override int CompareDocument(string baseUri, string nextbaseUri) - { - return 0; - } - - public override bool PreserveWhitespace(XPathNavigator node) - { - return true; - } - - public override bool Whitespace - { - get { return true; } - } - - /// <summary> - /// Resolves variables. - /// </summary> - /// <param name="prefix">The variable's prefix</param> - /// <param name="name">The variable's name</param> - /// <returns></returns> - public override IXsltContextVariable ResolveVariable(string prefix, string name) - { - return null; - } - - /// <summary> - /// Resolves custom function in XPath expression. - /// </summary> - /// <param name="prefix">The prefix of the function as it appears in the XPath expression.</param> - /// <param name="name">The name of the function.</param> - /// <param name="argTypes">An array of argument types for the function being resolved. - /// This allows you to select between methods with the same name (for example, overloaded - /// methods). </param> + + + public override bool PreserveWhitespace(XPathNavigator node) { + return true; + } + + public override bool Whitespace { + get { return true; } + } + + /// <summary> + /// Resolves variables. + /// </summary> + /// <param name="prefix">The variable's prefix</param> + /// <param name="name">The variable's name</param> + /// <returns></returns> + public override IXsltContextVariable ResolveVariable(string prefix, string name) { + return null; + } + + /// <summary> + /// Resolves custom function in XPath expression. + /// </summary> + /// <param name="prefix">The prefix of the function as it appears in the XPath expression.</param> + /// <param name="name">The name of the function.</param> + /// <param name="argTypes">An array of argument types for the function being resolved. + /// This allows you to select between methods with the same name (for example, overloaded + /// methods). </param> /// <returns>An IXsltContextFunction representing the function.</returns> - public override IXsltContextFunction ResolveFunction(string prefix, string name, - XPathResultType[] argTypes) - { - switch (LookupNamespace(_nt.Get(prefix))) - { - case ExsltNamespaces.DatesAndTimes: - return GetExtensionFunctionImplementation(exsltDatesAndTimes, name, argTypes); - case ExsltNamespaces.Math: - return GetExtensionFunctionImplementation(exsltMath, name, argTypes); - case ExsltNamespaces.RegularExpressions: - return GetExtensionFunctionImplementation(exsltRegularExpressions, name, argTypes); - case ExsltNamespaces.Sets: - return GetExtensionFunctionImplementation(exsltSets, name, argTypes); - case ExsltNamespaces.Strings: - return GetExtensionFunctionImplementation(exsltStrings, name, argTypes); - case ExsltNamespaces.Random: - return GetExtensionFunctionImplementation(exsltRandom, name, argTypes); + public override IXsltContextFunction ResolveFunction(string prefix, string name, + XPathResultType[] argTypes) { + switch (LookupNamespace(_nt.Get(prefix))) { + case ExsltNamespaces.Common: + return GetExtensionFunctionImplementation(exsltCommon, name, argTypes); + case ExsltNamespaces.DatesAndTimes: + return GetExtensionFunctionImplementation(exsltDatesAndTimes, name, argTypes); + case ExsltNamespaces.Math: + return GetExtensionFunctionImplementation(exsltMath, name, argTypes); + case ExsltNamespaces.RegularExpressions: + return GetExtensionFunctionImplementation(exsltRegularExpressions, name, argTypes); + case ExsltNamespaces.Sets: + return GetExtensionFunctionImplementation(exsltSets, name, argTypes); + case ExsltNamespaces.Strings: + return GetExtensionFunctionImplementation(exsltStrings, name, argTypes); + case ExsltNamespaces.Random: + return GetExtensionFunctionImplementation(exsltRandom, name, argTypes); case ExsltNamespaces.GDNDatesAndTimes: - return GetExtensionFunctionImplementation(gdnDatesAndTimes, name, argTypes); - case ExsltNamespaces.GDNMath: - return GetExtensionFunctionImplementation(gdnMath, name, argTypes); - case ExsltNamespaces.GDNRegularExpressions: - return GetExtensionFunctionImplementation(gdnRegularExpressions, name, argTypes); - case ExsltNamespaces.GDNSets: - return GetExtensionFunctionImplementation(gdnSets, name, argTypes); - case ExsltNamespaces.GDNStrings: - return GetExtensionFunctionImplementation(gdnStrings, name, argTypes); - case ExsltNamespaces.GDNDynamic: - return GetExtensionFunctionImplementation(gdnDynamic, name, argTypes); - default: - throw new XPathException(string.Format("Unrecognized extension function namespace: prefix='{0}', namespace URI='{1}'", - prefix, LookupNamespace(_nt.Get(prefix))), null); - } - } - #endregion + return GetExtensionFunctionImplementation(gdnDatesAndTimes, name, argTypes); + case ExsltNamespaces.GDNMath: + return GetExtensionFunctionImplementation(gdnMath, name, argTypes); + case ExsltNamespaces.GDNRegularExpressions: + return GetExtensionFunctionImplementation(gdnRegularExpressions, name, argTypes); + case ExsltNamespaces.GDNSets: + return GetExtensionFunctionImplementation(gdnSets, name, argTypes); + case ExsltNamespaces.GDNStrings: + return GetExtensionFunctionImplementation(gdnStrings, name, argTypes); + case ExsltNamespaces.GDNDynamic: + return GetExtensionFunctionImplementation(gdnDynamic, name, argTypes); + default: + throw new XPathException(string.Format("Unrecognized extension function namespace: prefix='{0}', namespace URI='{1}'", + prefix, LookupNamespace(_nt.Get(prefix))), null); + } + } /// <summary> /// Finds appropriate implementation for an extension function - public Index: ExsltSets.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v1/src/Exslt/ExsltSets.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ExsltSets.cs 15 Oct 2005 21:24:17 -0000 1.3 +++ ExsltSets.cs 22 Oct 2005 21:18:07 -0000 1.4 @@ -47,7 +47,7 @@ } } - return nodelist1; + return ExsltCommon.ExsltNodeListToXPathNodeIterator(nodelist1); } /// <summary> /// Implements an optimized algorithm for the following function |
From: Oleg T. <he...@us...> - 2005-10-22 21:18:16
|
Update of /cvsroot/mvp-xml/EXSLT/v1/src/MethodRenamer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15352/v1/src/MethodRenamer Modified Files: MethodRenamer.cs MethodRenamer.csproj Log Message: Index: MethodRenamer.csproj =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v1/src/MethodRenamer/MethodRenamer.csproj,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- MethodRenamer.csproj 15 Oct 2005 21:18:47 -0000 1.2 +++ MethodRenamer.csproj 22 Oct 2005 21:18:08 -0000 1.3 @@ -1,90 +1,99 @@ -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <ProjectType>Local</ProjectType> - <ProductVersion>8.0.50215</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{A22418E5-DCE6-4D12-A016-151EA614A787}</ProjectGuid> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ApplicationIcon> - </ApplicationIcon> - <AssemblyKeyContainerName> - </AssemblyKeyContainerName> - <AssemblyName>MethodRenamer</AssemblyName> - <AssemblyOriginatorKeyFile> - </AssemblyOriginatorKeyFile> - <DefaultClientScript>JScript</DefaultClientScript> - <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> - <DefaultTargetSchema>IE50</DefaultTargetSchema> - <DelaySign>false</DelaySign> - <OutputType>Exe</OutputType> - <RootNamespace>GotDotNet.Exslt.MethodRenamer</RootNamespace> - <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> - <StartupObject>Mvp.Xml.Exslt.MethodRenamer.MethodRenamer</StartupObject> - <FileUpgradeFlags> - </FileUpgradeFlags> - <UpgradeBackupLocation> - </UpgradeBackupLocation> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <OutputPath>.\</OutputPath> - <AllowUnsafeBlocks>false</AllowUnsafeBlocks> - <BaseAddress>285212672</BaseAddress> - <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> - <ConfigurationOverrideFile> - </ConfigurationOverrideFile> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <DocumentationFile> - </DocumentationFile> - <DebugSymbols>true</DebugSymbols> - <FileAlignment>4096</FileAlignment> - <NoStdLib>false</NoStdLib> - <NoWarn> - </NoWarn> - <Optimize>false</Optimize> - <RegisterForComInterop>false</RegisterForComInterop> - <RemoveIntegerChecks>false</RemoveIntegerChecks> - <TreatWarningsAsErrors>false</TreatWarningsAsErrors> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <OutputPath>.\</OutputPath> - <AllowUnsafeBlocks>false</AllowUnsafeBlocks> - <BaseAddress>285212672</BaseAddress> - <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> - <ConfigurationOverrideFile> - </ConfigurationOverrideFile> - <DefineConstants>TRACE</DefineConstants> - <DocumentationFile> - </DocumentationFile> - <DebugSymbols>false</DebugSymbols> - <FileAlignment>4096</FileAlignment> - <NoStdLib>false</NoStdLib> - <NoWarn> - </NoWarn> - <Optimize>true</Optimize> - <RegisterForComInterop>false</RegisterForComInterop> - <RemoveIntegerChecks>false</RemoveIntegerChecks> - <TreatWarningsAsErrors>false</TreatWarningsAsErrors> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="System"> - <Name>System</Name> - </Reference> - <Reference Include="System.configuration" /> - </ItemGroup> - <ItemGroup> - <None Include="App.config" /> - <Compile Include="MethodRenamer.cs"> - <SubType>Code</SubType> - </Compile> - </ItemGroup> - <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> - <PropertyGroup> - <PreBuildEvent> - </PreBuildEvent> - <PostBuildEvent> - </PostBuildEvent> - </PropertyGroup> -</Project> \ No newline at end of file +<VisualStudioProject> + <CSHARP + ProjectType = "Local" + ProductVersion = "7.10.3077" + SchemaVersion = "2.0" + ProjectGuid = "{A22418E5-DCE6-4D12-A016-151EA614A787}" + > + <Build> + <Settings + ApplicationIcon = "" + AssemblyKeyContainerName = "" + AssemblyName = "MethodRenamer" + AssemblyOriginatorKeyFile = "" + DefaultClientScript = "JScript" + DefaultHTMLPageLayout = "Grid" + DefaultTargetSchema = "IE50" + DelaySign = "false" + OutputType = "Exe" + PreBuildEvent = "" + PostBuildEvent = "" + RootNamespace = "GotDotNet.Exslt.MethodRenamer" + RunPostBuildEvent = "OnBuildSuccess" + StartupObject = "Mvp.Xml.Exslt.MethodRenamer.MethodRenamer" + > + <Config + Name = "Debug" + AllowUnsafeBlocks = "false" + BaseAddress = "285212672" + CheckForOverflowUnderflow = "false" + ConfigurationOverrideFile = "" + DefineConstants = "DEBUG;TRACE" + DocumentationFile = "" + DebugSymbols = "true" + FileAlignment = "4096" + IncrementalBuild = "true" + NoStdLib = "false" + NoWarn = "" + Optimize = "false" + OutputPath = ".\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "4" + /> + <Config + Name = "Release" + AllowUnsafeBlocks = "false" + BaseAddress = "285212672" + CheckForOverflowUnderflow = "false" + ConfigurationOverrideFile = "" + DefineConstants = "TRACE" + DocumentationFile = "" + DebugSymbols = "false" + FileAlignment = "4096" + IncrementalBuild = "false" + NoStdLib = "false" + NoWarn = "" + Optimize = "true" + OutputPath = ".\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "4" + /> + </Settings> + <References> + <Reference + Name = "System" + AssemblyName = "System" + HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll" + /> + <Reference + Name = "System.Data" + AssemblyName = "System.Data" + HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll" + /> + <Reference + Name = "System.XML" + AssemblyName = "System.Xml" + HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" + /> + </References> + </Build> + <Files> + <Include> + <File + RelPath = "App.config" + BuildAction = "None" + /> + <File + RelPath = "MethodRenamer.cs" + SubType = "Code" + BuildAction = "Compile" + /> + </Include> + </Files> + </CSHARP> +</VisualStudioProject> + Index: MethodRenamer.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v1/src/MethodRenamer/MethodRenamer.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- MethodRenamer.cs 15 Oct 2005 21:18:47 -0000 1.2 +++ MethodRenamer.cs 22 Oct 2005 21:18:08 -0000 1.3 @@ -5,51 +5,44 @@ using System.Text; using System.Configuration; -namespace Mvp.Xml.Exslt.MethodRenamer -{ - /// <summary> - /// An utility to rename methods in MSIL code. - /// </summary> - public class MethodRenamer - { - [STAThread] - static void Main(string[] args) - { - IDictionary dictionary = (IDictionary)ConfigurationManager.GetSection("names"); - //Reads input IL code - StreamReader reader = new StreamReader(args[0]); - //Writes output IL code - StreamWriter writer = new StreamWriter(args[1]); - string line; - //Go read line by line - while ((line = reader.ReadLine()) != null) - { - //Method definition? - if (line.Trim().StartsWith(".method")) - { - writer.WriteLine(line); - line = reader.ReadLine(); - if (line.IndexOf("(") != -1) - { - string methodName = line.Trim().Substring(0, line.Trim().IndexOf("(")); - if (dictionary.Contains(methodName)) - { - writer.WriteLine(line.Replace(methodName + "(", - "'" + (string)dictionary[methodName] + "'(")); - Console.WriteLine("Found '" + methodName + "' method, renamed to '" + - dictionary[methodName] + "'"); +namespace Mvp.Xml.Exslt.MethodRenamer { + /// <summary> + /// An utility to rename methods in MSIL code. + /// </summary> + public class MethodRenamer { + [STAThread] + static void Main(string[] args) { + IDictionary dictionary = (IDictionary)ConfigurationSettings.GetConfig("names"); + //Reads input IL code + StreamReader reader = new StreamReader(args[0]); + //Writes output IL code + StreamWriter writer = new StreamWriter(args[1]); + string line; + //Go read line by line + while ((line = reader.ReadLine())!=null) { + //Method definition? + if (line.Trim().StartsWith(".method")) { + writer.WriteLine(line); + line = reader.ReadLine(); + if (line.IndexOf("(")!=-1) { + string methodName = line.Trim().Substring(0, line.Trim().IndexOf("(")); + if (dictionary.Contains(methodName)) { + writer.WriteLine(line.Replace(methodName+"(", + "'"+(string)dictionary[methodName]+"'(")); + Console.WriteLine("Found '" + methodName + "' method, renamed to '" + + dictionary[methodName] + "'"); + } + else + writer.WriteLine(line); + } + else + writer.WriteLine(line); + } + else + writer.WriteLine(line); } - else - writer.WriteLine(line); - } - else - writer.WriteLine(line); + reader.Close(); + writer.Close(); } - else - writer.WriteLine(line); - } - reader.Close(); - writer.Close(); } - } -} \ No newline at end of file +} |
From: Oleg T. <he...@us...> - 2005-10-22 21:18:16
|
Update of /cvsroot/mvp-xml/EXSLT/v1/test/ExsltXPathTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15352/v1/test/ExsltXPathTest Modified Files: ExsltXPathTest.csproj Log Message: Index: ExsltXPathTest.csproj =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v1/test/ExsltXPathTest/ExsltXPathTest.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ExsltXPathTest.csproj 15 Oct 2005 21:11:45 -0000 1.3 +++ ExsltXPathTest.csproj 22 Oct 2005 21:18:08 -0000 1.4 @@ -1,103 +1,113 @@ -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <ProjectType>Local</ProjectType> - <ProductVersion>8.0.50215</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{705AA213-1D02-4CD2-9ED5-A7D9668C714D}</ProjectGuid> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ApplicationIcon> - </ApplicationIcon> - <AssemblyKeyContainerName> - </AssemblyKeyContainerName> - <AssemblyName>ExsltXPathTest</AssemblyName> - <AssemblyOriginatorKeyFile> - </AssemblyOriginatorKeyFile> - <DefaultClientScript>JScript</DefaultClientScript> - <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> - <DefaultTargetSchema>IE50</DefaultTargetSchema> - <DelaySign>false</DelaySign> - <OutputType>Exe</OutputType> - <RootNamespace>ExsltXPathTest</RootNamespace> - <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> - <StartupObject>ExsltXPathTest.ExsltXPathTest</StartupObject> - <FileUpgradeFlags> - </FileUpgradeFlags> - <UpgradeBackupLocation> - </UpgradeBackupLocation> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <OutputPath>.\</OutputPath> - <AllowUnsafeBlocks>false</AllowUnsafeBlocks> - <BaseAddress>285212672</BaseAddress> - <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> - <ConfigurationOverrideFile> - </ConfigurationOverrideFile> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <DocumentationFile> - </DocumentationFile> - <DebugSymbols>true</DebugSymbols> - <FileAlignment>4096</FileAlignment> - <NoStdLib>false</NoStdLib> - <NoWarn> - </NoWarn> - <Optimize>false</Optimize> - <RegisterForComInterop>false</RegisterForComInterop> - <RemoveIntegerChecks>false</RemoveIntegerChecks> - <TreatWarningsAsErrors>false</TreatWarningsAsErrors> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <OutputPath>.\</OutputPath> - <AllowUnsafeBlocks>false</AllowUnsafeBlocks> - <BaseAddress>285212672</BaseAddress> - <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow> - <ConfigurationOverrideFile> - </ConfigurationOverrideFile> - <DefineConstants>TRACE</DefineConstants> - <DocumentationFile> - </DocumentationFile> - <DebugSymbols>false</DebugSymbols> - <FileAlignment>4096</FileAlignment> - <NoStdLib>false</NoStdLib> - <NoWarn> - </NoWarn> - <Optimize>true</Optimize> - <RegisterForComInterop>false</RegisterForComInterop> - <RemoveIntegerChecks>false</RemoveIntegerChecks> - <TreatWarningsAsErrors>false</TreatWarningsAsErrors> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="Mvp.Xml.Exslt"> - <Name>Mvp.Xml.Exslt</Name> - <HintPath>..\..\src\Exslt\Mvp.Xml.Exslt.dll</HintPath> - </Reference> - <Reference Include="System"> - <Name>System</Name> - </Reference> - <Reference Include="System.Data"> - <Name>System.Data</Name> - </Reference> - <Reference Include="System.Xml"> - <Name>System.XML</Name> - </Reference> - </ItemGroup> - <ItemGroup> - <Compile Include="AssemblyInfo.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="ExsltXPathTest.cs"> - <SubType>Code</SubType> - </Compile> - <Content Include="tests\books.xml" /> - <Content Include="tests\foo.xml" /> - </ItemGroup> - <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> - <PropertyGroup> - <PreBuildEvent> - </PreBuildEvent> - <PostBuildEvent> - </PostBuildEvent> - </PropertyGroup> -</Project> \ No newline at end of file +<VisualStudioProject> + <CSHARP + ProjectType = "Local" + ProductVersion = "7.10.3077" + SchemaVersion = "2.0" + ProjectGuid = "{705AA213-1D02-4CD2-9ED5-A7D9668C714D}" + > + <Build> + <Settings + ApplicationIcon = "" + AssemblyKeyContainerName = "" + AssemblyName = "ExsltXPathTest" + AssemblyOriginatorKeyFile = "" + DefaultClientScript = "JScript" + DefaultHTMLPageLayout = "Grid" + DefaultTargetSchema = "IE50" + DelaySign = "false" + OutputType = "Exe" + PreBuildEvent = "" + PostBuildEvent = "" + RootNamespace = "ExsltXPathTest" + RunPostBuildEvent = "OnBuildSuccess" + StartupObject = "ExsltXPathTest.ExsltXPathTest" + > + <Config + Name = "Debug" + AllowUnsafeBlocks = "false" + BaseAddress = "285212672" + CheckForOverflowUnderflow = "false" + ConfigurationOverrideFile = "" + DefineConstants = "DEBUG;TRACE" + DocumentationFile = "" + DebugSymbols = "true" + FileAlignment = "4096" + IncrementalBuild = "true" + NoStdLib = "false" + NoWarn = "" + Optimize = "false" + OutputPath = ".\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "4" + /> + <Config + Name = "Release" + AllowUnsafeBlocks = "false" + BaseAddress = "285212672" + CheckForOverflowUnderflow = "false" + ConfigurationOverrideFile = "" + DefineConstants = "TRACE" + DocumentationFile = "" + DebugSymbols = "false" + FileAlignment = "4096" + IncrementalBuild = "false" + NoStdLib = "false" + NoWarn = "" + Optimize = "true" + OutputPath = ".\" + RegisterForComInterop = "false" + RemoveIntegerChecks = "false" + TreatWarningsAsErrors = "false" + WarningLevel = "4" + /> + </Settings> + <References> + <Reference + Name = "System" + AssemblyName = "System" + HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll" + /> + <Reference + Name = "System.Data" + AssemblyName = "System.Data" + HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll" + /> + <Reference + Name = "System.XML" + AssemblyName = "System.Xml" + HintPath = "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" + /> + <Reference + Name = "Mvp.Xml.Exslt" + AssemblyName = "Mvp.Xml.Exslt" + HintPath = "..\..\src\Exslt\Mvp.Xml.Exslt.dll" + /> + </References> + </Build> + <Files> + <Include> + <File + RelPath = "AssemblyInfo.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ExsltXPathTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "tests\books.xml" + BuildAction = "Content" + /> + <File + RelPath = "tests\foo.xml" + BuildAction = "Content" + /> + </Include> + </Files> + </CSHARP> +</VisualStudioProject> + |
From: Oleg T. <he...@us...> - 2005-10-22 21:18:16
|
Update of /cvsroot/mvp-xml/EXSLT/v1/test/ExsltTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15352/v1/test/ExsltTest Modified Files: ExsltTest.csproj Log Message: Index: ExsltTest.csproj =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v1/test/ExsltTest/ExsltTest.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ExsltTest.csproj 15 Oct 2005 21:13:53 -0000 1.3 +++ ExsltTest.csproj 22 Oct 2005 21:18:08 -0000 1.4 @@ -1,324 +1,881 @@ -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <ProjectType>Local</ProjectType> - <ProductVersion>8.0.50215</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{AC8B9015-E508-4E40-8E6D-C4FCF52CE4B0}</ProjectGuid> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ApplicationIcon> - </ApplicationIcon> - <AssemblyKeyContainerName> [...1175 lines suppressed...] + RelPath = "tests\GotDotNet\Sets\subset.xslt" + BuildAction = "Content" + /> + <File + RelPath = "tests\GotDotNet\Strings\lowercase.xslt" + BuildAction = "Content" + /> + <File + RelPath = "tests\GotDotNet\Strings\source.xml" + BuildAction = "Content" + /> + <File + RelPath = "tests\GotDotNet\Strings\uppercase.xslt" + BuildAction = "Content" + /> + </Include> + </Files> + </CSHARP> +</VisualStudioProject> + |
From: Oleg T. <he...@us...> - 2005-10-19 14:46:41
|
Update of /cvsroot/mvp-xml/Common/v2/src/XPath In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28965/v2/src/XPath Added Files: DynamicContext.cs IHasXPathNavigator.cs IndexingXPathNavigator.cs SubtreeeXPathNavigator.cs XPathCache.cs XPathIteratorReader.cs XPathNavigatorIterator.cs XPathVariable.cs Log Message: --- NEW FILE: DynamicContext.cs --- #region using using System; using System.Collections.Generic; using System.Reflection; using System.Text; using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; #endregion using namespace Mvp.Xml.Common.XPath { /// <summary> /// Provides the evaluation context for fast execution and custom /// variables resolution. /// </summary> /// <remarks> /// This class is responsible for resolving variables during dynamic expression execution. /// <para>Discussed in http://weblogs.asp.net/cazzu/archive/2003/10/07/30888.aspx</para> /// <para>Author: Daniel Cazzulino, kz...@gm...</para> /// </remarks> public class DynamicContext : XsltContext { #region Private vars IDictionary<string, DynamicVariable> _variables = new Dictionary<string, DynamicVariable>(); #endregion Private #region Constructors & Initialization /// <summary> /// Initializes a new instance of the <see cref="DynamicContext"/> class. /// </summary> public DynamicContext() : base(new NameTable()) { } /// <summary> /// Initializes a new instance of the <see cref="DynamicContext"/> /// class with the specified <see cref="NameTable"/>. /// </summary> /// <param name="table">The NameTable to use.</param> public DynamicContext(NameTable table) : base(table) { } /// <summary> /// Initializes a new instance of the <see cref="DynamicContext"/> class. /// </summary> /// <param name="context">A previously filled context with the namespaces to use.</param> public DynamicContext(XmlNamespaceManager context) : this(context, new NameTable()) { } /// <summary> /// Initializes a new instance of the <see cref="DynamicContext"/> class. /// </summary> /// <param name="context">A previously filled context with the namespaces to use.</param> /// <param name="table">The NameTable to use.</param> public DynamicContext(XmlNamespaceManager context, NameTable table) : base(table) { object xml = table.Add(XmlNamespaces.Xml); object xmlns = table.Add(XmlNamespaces.XmlNs); if (context != null) { foreach (string prefix in context) { string uri = context.LookupNamespace(prefix); // Use fast object reference comparison to omit forbidden namespace declarations. if (Object.Equals(uri, xml) || Object.Equals(uri, xmlns)) continue; base.AddNamespace(prefix, uri); } } } #endregion Constructors & Initialization #region Common Overrides /// <summary> /// Implementation equal to <see cref="XsltContext.CompareDocument(string, string)"/>. /// </summary> public override int CompareDocument(string baseUri, string nextbaseUri) { return String.Compare(baseUri, nextbaseUri, false, System.Globalization.CultureInfo.InvariantCulture); } /// <summary> /// Same as <see cref="XmlNamespaceManager"/>. /// </summary> public override string LookupNamespace(string prefix) { string key = NameTable.Get(prefix); if (key == null) return null; else return base.LookupNamespace(key); } /// <summary> /// Same as <see cref="XmlNamespaceManager"/>. /// </summary> public override string LookupPrefix(string uri) { string key = NameTable.Get(uri); if (key == null) return null; else return base.LookupPrefix(key); } /// <summary> /// Same as <see cref="XsltContext.PreserveWhitespace(XPathNavigator)"/>. /// </summary> public override bool PreserveWhitespace(XPathNavigator node) { return true; } /// <summary> /// Same as <see cref="XsltContext.Whitespace"/>. /// </summary> public override bool Whitespace { get { return true; } } #endregion Common Overrides #region Public Members /// <summary> /// Shortcut method that compiles an expression using an empty navigator. /// </summary> /// <param name="xpath">The expression to compile</param> /// <returns>A compiled <see cref="XPathExpression"/>.</returns> public static XPathExpression Compile(string xpath) { return new XmlDocument().CreateNavigator().Compile(xpath); } #endregion Public Members #region Variable Handling Code /// <summary> /// Adds the variable to the dynamic evaluation context. /// </summary> /// <param name="name">The name of the variable to add to the context.</param> /// <param name="value">The value of the variable to add to the context.</param> /// <remarks> /// Value type conversion for XPath evaluation is as follows: /// <list type="table"> /// <listheader> /// <term>CLR Type</term> /// <description>XPath type</description> /// </listheader> /// <item> /// <term>System.String</term> /// <description>XPathResultType.String</description> /// </item> /// <item> /// <term>System.Double (or types that can be converted to)</term> /// <description>XPathResultType.Number</description> /// </item> /// <item> /// <term>System.Boolean</term> /// <description>XPathResultType.Boolean</description> /// </item> /// <item> /// <term>System.Xml.XPath.XPathNavigator</term> /// <description>XPathResultType.Navigator</description> /// </item> /// <item> /// <term>System.Xml.XPath.XPathNodeIterator</term> /// <description>XPathResultType.NodeSet</description> /// </item> /// <item> /// <term>Others</term> /// <description>XPathResultType.Any</description> /// </item> /// </list> /// <note type="note">See the topic "Compile, Select, Evaluate, and Matches with /// XPath and XPathExpressions" in MSDN documentation for additional information.</note> /// </remarks> /// <exception cref="ArgumentNullException">The <paramref name="value"/> is null.</exception> public void AddVariable(string name, object value) { if (value == null) throw new ArgumentNullException("value"); _variables[name] = new DynamicVariable(name, value); } /// <summary> /// See <see cref="XsltContext"/>. Not used in our implementation. /// </summary> public override IXsltContextFunction ResolveFunction(string prefix, string name, XPathResultType[] ArgTypes) { return null; } /// <summary> /// Resolves the dynamic variables added to the context. See <see cref="XsltContext"/>. /// </summary> public override IXsltContextVariable ResolveVariable(string prefix, string name) { return _variables[name] as IXsltContextVariable; } #endregion Variable Handling Code #region Internal DynamicVariable class /// <summary> /// Represents a variable during dynamic expression execution. /// </summary> internal class DynamicVariable : IXsltContextVariable { string _name; object _value; #region Public Members /// <summary> /// Initializes a new instance of the class. /// </summary> /// <param name="name">The name of the variable.</param> /// <param name="value">The value of the variable.</param> public DynamicVariable(string name, object value) { _name = name; _value = value; if (value is String) _type = XPathResultType.String; else if (value is bool) _type = XPathResultType.Boolean; else if (value is XPathNavigator) _type = XPathResultType.Navigator; else if (value is XPathNodeIterator) _type = XPathResultType.NodeSet; else { // Try to convert to double (native XPath numeric type) if (value is double) { _type = XPathResultType.Number; } else { if (value is IConvertible) { try { _value = Convert.ToDouble(value); // We suceeded, so it's a number. _type = XPathResultType.Number; } catch (FormatException) { _type = XPathResultType.Any; } catch (OverflowException) { _type = XPathResultType.Any; } } else { _type = XPathResultType.Any; } } } } #endregion Public Members #region IXsltContextVariable Implementation XPathResultType IXsltContextVariable.VariableType { get { return _type; } } XPathResultType _type; object IXsltContextVariable.Evaluate(XsltContext context) { return _value; } bool IXsltContextVariable.IsLocal { get { return false; } } bool IXsltContextVariable.IsParam { get { return false; } } #endregion IXsltContextVariable Implementation } #endregion Internal DynamicVariable class } } --- NEW FILE: XPathIteratorReader.cs --- #region using using System; using System.Collections; using System.Collections.Specialized; using System.IO; using System.Xml; using System.Xml.Serialization; using System.Xml.XPath; #endregion using namespace Mvp.Xml.Common.XPath { /// <summary> /// Provides an <see cref="XmlReader"/> over an /// <see cref="XPathNodeIterator"/>. /// </summary> /// <remarks> /// The reader exposes a new root element enclosing all navigators from the /// iterator. This root node is configured in the constructor, by /// passing the desired name and optional namespace for it. /// <para>Author: Daniel Cazzulino, kz...@gm...</para> /// See: http://weblogs.asp.net/cazzu/archive/2004/04/26/120684.aspx /// </remarks> public class XPathIteratorReader : XmlTextReader, IXmlSerializable { #region Fields // Holds the current child being read. XmlReader _current; // Holds the iterator passed to the ctor. XPathNodeIterator _iterator; // The name for the root element. XmlQualifiedName _rootname; #endregion Fields #region Ctor /// <summary> /// Parameterless constructor for XML serialization. /// </summary> /// <remarks>Supports the .NET serialization infrastructure. Don't use this /// constructor in your regular application.</remarks> [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public XPathIteratorReader() { } /// <summary> /// Initializes the reader, using the default <root> element. /// </summary> /// <param name="iterator">The iterator to expose as a single reader.</param> public XPathIteratorReader(XPathNodeIterator iterator) : this(iterator, "root", String.Empty) { } /// <summary> /// Initializes the reader. /// </summary> /// <param name="iterator">The iterator to expose as a single reader.</param> /// <param name="rootName">The name to use for the enclosing root element.</param> public XPathIteratorReader(XPathNodeIterator iterator, string rootName) : this(iterator, rootName, String.Empty) { } /// <summary> /// Initializes the reader. /// </summary> /// <param name="iterator">The iterator to expose as a single reader.</param> /// <param name="rootName">The name to use for the enclosing root element.</param> /// <param name="ns">The namespace URI of the root element.</param> public XPathIteratorReader(XPathNodeIterator iterator, string rootName, string ns) : base(new StringReader(String.Empty)) { _iterator = iterator.Clone(); _current = new FakedRootReader(rootName, ns, XmlNodeType.Element); _rootname = new XmlQualifiedName(rootName, ns); } #endregion Ctor #region Private Members /// <summary> /// Returns the XML representation of the current node and all its children. /// </summary> private string Serialize() { StringWriter sw = new StringWriter(System.Globalization.CultureInfo.CurrentCulture); XmlTextWriter tw = new XmlTextWriter(sw); tw.WriteNode(this, false); sw.Flush(); return sw.ToString(); } #endregion Private Members #region Properties /// <summary>See <see cref="XmlReader.AttributeCount"/></summary> public override int AttributeCount { get { return _current.AttributeCount; } } /// <summary>See <see cref="XmlReader.BaseURI"/></summary> public override string BaseURI { get { return _current.BaseURI; } } /// <summary>See <see cref="XmlReader.Depth"/></summary> public override int Depth { get { return _current.Depth + 1; } } /// <summary>See <see cref="XmlReader.EOF"/></summary> public override bool EOF { get { return _current.ReadState == ReadState.EndOfFile || _current.ReadState == ReadState.Closed; } } /// <summary>See <see cref="XmlReader.HasValue"/></summary> public override bool HasValue { get { return _current.HasValue; } } /// <summary>See <see cref="XmlReader.IsDefault"/></summary> public override bool IsDefault { get { return false; } } /// <summary>See <see cref="XmlReader.IsDefault"/></summary> public override bool IsEmptyElement { get { return _current.IsEmptyElement; } } /// <summary>See <see cref="XmlReader.this[string, string]"/></summary> public override string this[string name, string ns] { get { return _current[name, ns]; } } /// <summary>See <see cref="XmlReader.this[string]"/></summary> public override string this[string name] { get { return _current[name, String.Empty]; } } /// <summary>See <see cref="XmlReader.this[int]"/></summary> public override string this[int i] { get { return _current[i]; } } /// <summary>See <see cref="XmlReader.LocalName"/></summary> public override string LocalName { get { return _current.LocalName; } } /// <summary>See <see cref="XmlReader.Name"/></summary> public override string Name { get { return _current.Name; } } /// <summary>See <see cref="XmlReader.NamespaceURI"/></summary> public override string NamespaceURI { get { return _current.NamespaceURI; } } /// <summary>See <see cref="XmlReader.NameTable"/></summary> public override XmlNameTable NameTable { get { return _current.NameTable; } } /// <summary>See <see cref="XmlReader.NodeType"/></summary> public override XmlNodeType NodeType { get { return _current.NodeType; } } /// <summary>See <see cref="XmlReader.Prefix"/></summary> public override string Prefix { get { return _current.Prefix; } } /// <summary>See <see cref="XmlReader.QuoteChar"/></summary> public override char QuoteChar { get { return _current.QuoteChar; } } /// <summary>See <see cref="XmlReader.ReadState"/></summary> public override ReadState ReadState { get { return _current.ReadState; } } /// <summary>See <see cref="XmlReader.Value"/></summary> public override string Value { get { return _current.Value; } } /// <summary>See <see cref="XmlReader.XmlLang"/></summary> public override string XmlLang { get { return _current.XmlLang; } } /// <summary>See <see cref="XmlReader.XmlSpace"/></summary> public override XmlSpace XmlSpace { get { return XmlSpace.Default; } } #endregion Properties #region Methods /// <summary>See <see cref="XmlReader.Close"/></summary> public override void Close() { _current.Close(); } /// <summary>See <see cref="XmlReader.GetAttribute(string, string)"/></summary> public override string GetAttribute(string name, string ns) { return _current.GetAttribute(name, ns); } /// <summary>See <see cref="XmlReader.GetAttribute(string)"/></summary> public override string GetAttribute(string name) { return _current.GetAttribute(name); } /// <summary>See <see cref="XmlReader.GetAttribute(int)"/></summary> public override string GetAttribute(int i) { return _current.GetAttribute(i); } /// <summary>See <see cref="XmlReader.LookupNamespace"/></summary> public override string LookupNamespace(string prefix) { return _current.LookupNamespace(prefix); } /// <summary>See <see cref="XmlReader.MoveToAttribute(string, string)"/></summary> public override bool MoveToAttribute(string name, string ns) { return _current.MoveToAttribute(name, ns); } /// <summary>See <see cref="XmlReader.MoveToAttribute(string)"/></summary> public override bool MoveToAttribute(string name) { return _current.MoveToAttribute(name); } /// <summary>See <see cref="XmlReader.MoveToAttribute(int)"/></summary> public override void MoveToAttribute(int i) { _current.MoveToAttribute(i); } /// <summary>See <see cref="XmlReader.MoveToContent"/></summary> public override XmlNodeType MoveToContent() { return base.MoveToContent(); } /// <summary>See <see cref="XmlReader.MoveToElement"/></summary> public override bool MoveToElement() { return _current.MoveToElement(); } /// <summary>See <see cref="XmlReader.MoveToFirstAttribute"/></summary> public override bool MoveToFirstAttribute() { return _current.MoveToFirstAttribute(); } /// <summary>See <see cref="XmlReader.MoveToNextAttribute"/></summary> public override bool MoveToNextAttribute() { return _current.MoveToNextAttribute(); } /// <summary>See <see cref="XmlReader.Read"/></summary> public override bool Read() { // Return fast if state is no appropriate. if (_current.ReadState == ReadState.Closed || _current.ReadState == ReadState.EndOfFile) return false; bool read = _current.Read(); if (!read) { read = _iterator.MoveNext(); if (read) { // Just move to the next node and create the reader. _current = _iterator.Current.ReadSubtree(); return _current.Read(); } else { if (_current is FakedRootReader && _current.NodeType == XmlNodeType.EndElement) { // We're done! return false; } else { // We read all nodes in the iterator. Return to faked root end element. _current = new FakedRootReader(_rootname.Name, _rootname.Namespace, XmlNodeType.EndElement); return true; } } } return read; } /// <summary>See <see cref="XmlReader.ReadAttributeValue"/></summary> public override bool ReadAttributeValue() { return _current.ReadAttributeValue(); } /// <summary>See <see cref="XmlReader.ReadInnerXml"/></summary> public override string ReadInnerXml() { if (this.Read()) return Serialize(); return String.Empty; } /// <summary>See <see cref="XmlReader.ReadOuterXml"/></summary> public override string ReadOuterXml() { if (_current.ReadState != ReadState.Interactive) return String.Empty; return Serialize(); } /// <summary>See <see cref="XmlReader.Read"/></summary> public override void ResolveEntity() { // Not supported. } #endregion Methods #region IXmlSerializable Members /// <summary> /// See <see cref="IXmlSerializable.WriteXml"/>. /// </summary> public void WriteXml(XmlWriter writer) { writer.WriteNode(this, false); } /// <summary> /// See <see cref="IXmlSerializable.GetSchema"/>. /// </summary> public System.Xml.Schema.XmlSchema GetSchema() { return null; } /// <summary> /// See <see cref="IXmlSerializable.ReadXml"/>. /// </summary> public void ReadXml(XmlReader reader) { XPathDocument doc = new XPathDocument(reader); XPathNavigator nav = doc.CreateNavigator(); // Pull the faked root out. nav.MoveToFirstChild(); _rootname = new XmlQualifiedName(nav.LocalName, nav.NamespaceURI); // Get iterator for all child nodes. _iterator = nav.SelectChildren(XPathNodeType.All); } #endregion #region Internal Classes #region FakedRootReader private class FakedRootReader : XmlReader { public FakedRootReader(string name, string ns, XmlNodeType nodeType) { _name = name; _namespace = ns; _nodetype = nodeType; _state = nodeType == XmlNodeType.Element ? ReadState.Initial : ReadState.Interactive; } #region Properties /// <summary>See <see cref="XmlReader.AttributeCount"/></summary> public override int AttributeCount { get { return 0; } } /// <summary>See <see cref="XmlReader.BaseURI"/></summary> public override string BaseURI { get { return String.Empty; } } /// <summary>See <see cref="XmlReader.Depth"/></summary> public override int Depth { // Undo the depth increment of the outer reader. get { return -1; } } /// <summary>See <see cref="XmlReader.EOF"/></summary> public override bool EOF { get { return _state == ReadState.EndOfFile; } } /// <summary>See <see cref="XmlReader.HasValue"/></summary> public override bool HasValue { get { return false; } } /// <summary>See <see cref="XmlReader.IsDefault"/></summary> public override bool IsDefault { get { return false; } } /// <summary>See <see cref="XmlReader.IsDefault"/></summary> public override bool IsEmptyElement { get { return false; } } /// <summary>See <see cref="XmlReader.this[string, string]"/></summary> public override string this[string name, string ns] { get { return null; } } /// <summary>See <see cref="XmlReader.this[string]"/></summary> public override string this[string name] { get { return null; } } /// <summary>See <see cref="XmlReader.this[string]"/></summary> public override string this[int i] { get { return null; } } /// <summary>See <see cref="XmlReader.LocalName"/></summary> public override string LocalName { get { return _name; } } string _name; /// <summary>See <see cref="XmlReader.Name"/></summary> public override string Name { get { return _name; } } /// <summary>See <see cref="XmlReader.NamespaceURI"/></summary> public override string NamespaceURI { get { return _namespace; } } string _namespace; /// <summary>See <see cref="XmlReader.NameTable"/></summary> public override XmlNameTable NameTable { get { return null; } } /// <summary>See <see cref="XmlReader.NodeType"/></summary> public override XmlNodeType NodeType { get { return _state == ReadState.Initial ? XmlNodeType.None : _nodetype; } } XmlNodeType _nodetype; /// <summary>See <see cref="XmlReader.Prefix"/></summary> public override string Prefix { get { return String.Empty; } } /// <summary>See <see cref="XmlReader.QuoteChar"/></summary> public override char QuoteChar { get { return '"'; } } /// <summary>See <see cref="XmlReader.ReadState"/></summary> public override ReadState ReadState { get { return _state; } } ReadState _state; /// <summary>See <see cref="XmlReader.Value"/></summary> public override string Value { get { return String.Empty; } } /// <summary>See <see cref="XmlReader.XmlLang"/></summary> public override string XmlLang { get { return String.Empty; } } /// <summary>See <see cref="XmlReader.XmlSpace"/></summary> public override XmlSpace XmlSpace { get { return XmlSpace.Default; } } #endregion Properties #region Methods /// <summary>See <see cref="XmlReader.Close"/></summary> public override void Close() { _state = ReadState.Closed; } /// <summary>See <see cref="XmlReader.GetAttribute(string, string)"/></summary> public override string GetAttribute(string name, string ns) { return null; } /// <summary>See <see cref="XmlReader.GetAttribute(string)"/></summary> public override string GetAttribute(string name) { return null; } /// <summary>See <see cref="XmlReader.GetAttribute(int)"/></summary> public override string GetAttribute(int i) { return null; } /// <summary>See <see cref="XmlReader.LookupNamespace"/></summary> public override string LookupNamespace(string prefix) { return null; } /// <summary>See <see cref="XmlReader.MoveToAttribute(string, string)"/></summary> public override bool MoveToAttribute(string name, string ns) { return false; } /// <summary>See <see cref="XmlReader.MoveToAttribute(string)"/></summary> public override bool MoveToAttribute(string name) { return false; } /// <summary>See <see cref="XmlReader.MoveToAttribute(int)"/></summary> public override void MoveToAttribute(int i) { } public override XmlNodeType MoveToContent() { if (_state == ReadState.Initial) _state = ReadState.Interactive; return _nodetype; } /// <summary>See <see cref="XmlReader.MoveToElement"/></summary> public override bool MoveToElement() { return false; } /// <summary>See <see cref="XmlReader.MoveToFirstAttribute"/></summary> public override bool MoveToFirstAttribute() { return false; } /// <summary>See <see cref="XmlReader.MoveToNextAttribute"/></summary> public override bool MoveToNextAttribute() { return false; } /// <summary>See <see cref="XmlReader.Read"/></summary> public override bool Read() { if (_state == ReadState.Initial) { _state = ReadState.Interactive; return true; } if (_state == ReadState.Interactive && _nodetype == XmlNodeType.EndElement) { _state = ReadState.EndOfFile; return false; } return false; } /// <summary>See <see cref="XmlReader.ReadAttributeValue"/></summary> public override bool ReadAttributeValue() { return false; } /// <summary>See <see cref="XmlReader.ReadInnerXml"/></summary> public override string ReadInnerXml() { return String.Empty; } /// <summary>See <see cref="XmlReader.ReadOuterXml"/></summary> public override string ReadOuterXml() { return String.Empty; } /// <summary>See <see cref="XmlReader.Read"/></summary> public override void ResolveEntity() { // Not supported. } #endregion Methods } #endregion FakedRootReader #endregion Internal Classes } } --- NEW FILE: IndexingXPathNavigator.cs --- #region using using System; using System.Collections.Generic; using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; using System.Reflection; #endregion using namespace Mvp.Xml.Common.XPath { /// <summary> /// IndexingXPathNavigator enables lazy or eager indexing of any XML store /// (XmlDocument, XPathDocument or any other IXPathNavigable store) thus /// providing alternative way to select nodes directly from built index table /// and not searhing the tree. This allows drastically decrease selection time /// on preindexed selections. /// </summary> /// <remarks>Author: Oleg Tkachenko, ol...@tk... /// Contributors: Daniel Cazzulino, kz...@gm... /// <para>See http://www.tkachenko.com/blog/archives/000194.html</para> /// </remarks> public class IndexingXPathNavigator : XPathNavigator { #region Fields & Ctor private XPathNavigator nav; private XPathNavigatorIndexManager manager; /// <summary> /// Creates IndexingXPathNavigator over specified XPathNavigator. /// </summary> /// <param name="navigator">Core XPathNavigator</param> public IndexingXPathNavigator(XPathNavigator navigator) { this.nav = navigator; manager = new XPathNavigatorIndexManager(); } #endregion Fields & Ctor #region Public Methods /// <summary> /// Builds indexes according to defined keys. /// </summary> public void BuildIndexes() { manager.BuildIndexes(); } /// <summary> /// Adds named key for use with key() function. /// </summary> /// <param name="keyName">The name of the key</param> /// <param name="match">XPath pattern, defining the nodes to which /// this key is applicable</param> /// <param name="use">XPath expression used to determine /// the value of the key for each matching node</param> public virtual void AddKey(string keyName, string match, string use) { KeyDef key = new KeyDef(nav, match, use); manager.AddKey(nav, keyName, key); } #endregion Public Methods #region Important Overrides /// <summary> /// Compiles XPath expressions using base XPathNavigator.Compile() /// method and set IndexingXsltContext instance to the result of /// the compilation so compiled expressions support key() extension /// function. /// </summary> /// <param name="xpath">XPath expression to complile</param> /// <returns>Compiled XPath expression with augmented context /// to support key() extension function</returns> public override XPathExpression Compile(string xpath) { XPathExpression expr = base.Compile(xpath); expr.SetContext(new IndexingXsltContext(manager, nav.NameTable)); return expr; } /// <summary> /// Selects a node set using the specified XPath expression. /// </summary> /// <param name="xpath">A string representing an XPath expression</param> /// <returns>An XPathNodeIterator pointing to the selected node set</returns> public override XPathNodeIterator Select(string xpath) { XPathExpression expr = Compile(xpath); return base.Select(expr); } /// <summary> /// Creates new cloned version of the IndexingXPathNavigator. /// </summary> /// <returns>Cloned copy of the IndexingXPathNavigator</returns> public override XPathNavigator Clone() { return new IndexingXPathNavigator(nav.Clone()); } #endregion Important Overrides #region XPathNavigator dummy overrides /// <summary> /// See <see cref="XPathNavigator.NodeType"/>. /// </summary> public override XPathNodeType NodeType { get { return nav.NodeType; } } /// <summary> /// See <see cref="XPathNavigator.LocalName"/>. /// </summary> public override string LocalName { get { return nav.LocalName; } } /// <summary> /// See <see cref="XPathNavigator.Name"/>. /// </summary> public override string Name { get { return nav.Name; } } /// <summary> /// See <see cref="XPathNavigator.NamespaceURI"/>. /// </summary> public override string NamespaceURI { get { return nav.NamespaceURI; } } /// <summary> /// See <see cref="XPathNavigator.Prefix"/>. /// </summary> public override string Prefix { get { return nav.Prefix; } } /// <summary> /// See <see cref="XPathItem.Value"/>. /// </summary> public override string Value { get { return nav.Value; } } /// <summary> /// See <see cref="XPathNavigator.BaseURI"/>. /// </summary> public override String BaseURI { get { return nav.BaseURI; } } /// <summary> /// See <see cref="XPathNavigator.IsEmptyElement"/>. /// </summary> public override bool IsEmptyElement { get { return nav.IsEmptyElement; } } /// <summary> /// See <see cref="XPathNavigator.XmlLang"/>. /// </summary> public override string XmlLang { get { return nav.XmlLang; } } /// <summary> /// See <see cref="XPathNavigator.NameTable"/>. /// </summary> public override XmlNameTable NameTable { get { return nav.NameTable; } } /// <summary> /// See <see cref="XPathNavigator.HasAttributes"/>. /// </summary> public override bool HasAttributes { get { return nav.HasAttributes; } } /// <summary> /// See <see cref="XPathNavigator.GetAttribute"/>. /// </summary> public override string GetAttribute(string localName, string namespaceURI) { return nav.GetAttribute(localName, namespaceURI); } /// <summary> /// See <see cref="XPathNavigator.MoveToAttribute"/>. /// </summary> public override bool MoveToAttribute(string localName, string namespaceURI) { return nav.MoveToAttribute(localName, namespaceURI); } /// <summary> /// See <see cref="XPathNavigator.MoveToFirstAttribute"/>. /// </summary> public override bool MoveToFirstAttribute() { return nav.MoveToFirstAttribute(); } /// <summary> /// See <see cref="XPathNavigator.MoveToNextAttribute"/>. /// </summary> public override bool MoveToNextAttribute() { return nav.MoveToNextAttribute(); } /// <summary> /// See <see cref="XPathNavigator.GetNamespace"/>. /// </summary> public override string GetNamespace(string localname) { return nav.GetNamespace(localname); } /// <summary> /// See <see cref="XPathNavigator.MoveToNamespace"/>. /// </summary> public override bool MoveToNamespace(string @namespace) { return nav.MoveToNamespace(@namespace); } /// <summary> /// See <see cref="XPathNavigator.MoveToFirstNamespace(XPathNamespaceScope)"/>. /// </summary> public override bool MoveToFirstNamespace(XPathNamespaceScope namespaceScope) { return nav.MoveToFirstNamespace(namespaceScope); } /// <summary> /// See <see cref="XPathNavigator.MoveToNextNamespace(XPathNamespaceScope)"/>. /// </summary> public override bool MoveToNextNamespace(XPathNamespaceScope namespaceScope) { return nav.MoveToNextNamespace(namespaceScope); } /// <summary> /// See <see cref="XPathNavigator.MoveToNext()"/>. /// </summary> public override bool MoveToNext() { return nav.MoveToNext(); } /// <summary> /// See <see cref="XPathNavigator.MoveToPrevious"/>. /// </summary> public override bool MoveToPrevious() { return nav.MoveToPrevious(); } /// <summary> /// See <see cref="XPathNavigator.MoveToFirst"/>. /// </summary> public override bool MoveToFirst() { return nav.MoveToFirst(); } /// <summary> /// See <see cref="XPathNavigator.MoveToFirstChild"/>. /// </summary> public override bool MoveToFirstChild() { return nav.MoveToFirstChild(); } /// <summary> /// See <see cref="XPathNavigator.MoveToParent"/>. /// </summary> public override bool MoveToParent() { return nav.MoveToParent(); } /// <summary> /// See <see cref="XPathNavigator.MoveToRoot"/>. /// </summary> public override void MoveToRoot() { nav.MoveToRoot(); } /// <summary> /// See <see cref="XPathNavigator.MoveTo"/>. /// </summary> public override bool MoveTo(XPathNavigator other) { return nav.MoveTo(other); } /// <summary> /// See <see cref="XPathNavigator.MoveToId"/>. /// </summary> public override bool MoveToId(string id) { return nav.MoveToId(id); } /// <summary> /// See <see cref="XPathNavigator.IsSamePosition"/>. /// </summary> public override bool IsSamePosition(XPathNavigator other) { return nav.IsSamePosition(other); } /// <summary> /// See <see cref="XPathNavigator.HasChildren"/>. /// </summary> public override bool HasChildren { get { return nav.HasChildren; } } #endregion #region Internal classes #region IndexingXsltContext /// <summary> /// XsltContext providing key() extension function. /// </summary> private class IndexingXsltContext: XsltContext { private KeyExtensionFunction keyFuncImpl; /// <summary> /// Creates new IndexingXsltContext. /// </summary> /// <param name="manager">Newly created IndexingXsltContext</param> /// <param name="nt">The name table to use.</param> public IndexingXsltContext(XPathNavigatorIndexManager manager, XmlNameTable nt) : base (nt as NameTable) { keyFuncImpl = new KeyExtensionFunction(manager); } /// <summary> /// Not applicable. /// </summary> public override int CompareDocument(string baseUri, string nextbaseUri) { return 0; } /// <summary> /// Not applicable. /// </summary> public override bool PreserveWhitespace(XPathNavigator node) { return true; } /// <summary> /// Not applicable. /// </summary> public override bool Whitespace { get { return true; } } /// <summary> /// No custom variables. /// </summary> public override IXsltContextVariable ResolveVariable(string prefix, string name) { return null; } /// <summary> /// Resolves key() extension function. /// </summary> /// <param name="prefix">The prefix of the function as it appears in the XPath expression</param> /// <param name="name">The name of the function</param> /// <param name="argTypes">An array of argument types for the function being resolved</param> /// <returns>KeyExtentionFunction implementation for key() extension function and null /// for anything else.</returns> public override IXsltContextFunction ResolveFunction(string prefix, string name, XPathResultType[] argTypes) { if (prefix.Length == 0 && name == "key") { if (argTypes.Length != 2) throw new ArgumentException(SR.GetString(SR.IndexingXPathNavigator_KeyWrongArguments)); else if (argTypes[0] != XPathResultType.String) throw new ArgumentException(SR.GetString(SR.IndexingXPathNavigator_KeyArgumentNotString)); else return keyFuncImpl; } else return null; } } #endregion IndexingXsltContext #region KeyExtensionFunction /// <summary> /// key() extension function implementation. /// </summary> private class KeyExtensionFunction : IXsltContextFunction { private const int args = 2; private static readonly XPathResultType[] argTypes = new XPathResultType[] {XPathResultType.String, XPathResultType.Any}; private XPathNavigatorIndexManager manager; /// <summary> /// Creates new KeyExtentionFunction object. /// </summary> /// <param name="manager">Index manager for accessing indexes</param> public KeyExtensionFunction(XPathNavigatorIndexManager manager) { this.manager = manager; } /// <summary> /// Gets the minimum number of arguments for the function. /// </summary> public int Minargs { get { return args; } } /// <summary> /// Gets the maximum number of arguments for the function. /// </summary> public int Maxargs { get { return args; } } /// <summary> /// Gets the supplied XPath types for the function's argument list. /// </summary> public XPathResultType[] ArgTypes { get { return argTypes; } } /// <summary> /// Gets the XPathResultType representing the XPath type returned by the function. /// </summary> public XPathResultType ReturnType { get { return XPathResultType.NodeSet; } } /// <summary> /// Provides the method to invoke the function with the given arguments in the given context. /// </summary> /// <param name="xsltContext">Given XSLT context</param> /// <param name="args">Array of actual arguments</param> /// <param name="docContext">Context document</param> /// <returns></returns> public object Invoke(XsltContext xsltContext, object[] args, XPathNavigator docContext) { return manager.GetNodes((string)args[0], args[1]); } } #endregion KeyExtensionFunction #region KeyDef /// <summary> /// Compilable key definition. /// </summary> private class KeyDef { private string match, use; private XPathExpression matchExpr, useExpr; private XPathNavigator nav; /// <summary> /// Creates a key definition with specified 'match' and 'use' expressions. /// </summary> /// <param name="nav">XPathNavigator to compile XPath expressions</param> /// <param name="match">XPath pattern, defining the nodes to /// which this key is applicable</param> /// <param name="use">XPath expression expression used to /// determine the value of the key for each matching node.</param> public KeyDef(XPathNavigator nav, string match, string use) { this.nav= nav; this.match = match; this.use = use; } /// <summary> /// XPath pattern, defining the nodes to /// which this key is applicable. /// </summary> public string Match { get { return match; } set { match = value; } } /// <summary> /// XPath expression expression used to /// determine the value of the key for each matching node. /// </summary> public string Use { get { return use; } set { use = value; } } /// <summary> /// Compiled XPath pattern, defining the nodes to /// which this key is applicable. /// </summary> public XPathExpression MatchExpr { get { if (matchExpr == null) matchExpr = nav.Compile(match); return matchExpr; } } /// <summary> /// Compiled XPath expression expression used to /// determine the value of the key for each matching node. /// </summary> public XPathExpression UseExpr { get { if (useExpr == null) useExpr = nav.Compile(use); return useExpr; } } /// <summary> /// Compiles match and use expressions. /// </summary> public void Compile() { matchExpr = nav.Compile(match); useExpr = nav.Compile(use); } } #endregion KeyDef #region XPathNavigatorIndex /// <summary> /// Index table for XPathNavigator. /// </summary> private class XPathNavigatorIndex { private IList<KeyDef> keys; private IDictionary<string, List<XPathNavigator>> index; private Type arrayIteratorType; /// <summary> /// Creates index over specified XPathNavigator. /// </summary> public XPathNavigatorIndex() { keys = new List<KeyDef>(); index = new Dictionary<string, List<XPathNavigator>>(); Assembly systemXml = typeof(XPathNodeIterator).Assembly; // TODO: is there another way? arrayIteratorType = systemXml.GetType("System.Xml.XPath.XPathArrayIterator"); } /// <summary> /// Adds a key. /// </summary> /// <param name="key">Key definition</param> public void AddKey(KeyDef key) { keys.Add(key); } /// <summary> /// Returns indexed nodes by a key value. /// </summary> /// <param name="keyValue">Key value</param> public XPathNodeIterator GetNodes(object keyValue) { //As per XSLT spec: //When the second argument to the key function is of type node-set, //then the result is the union of the result of applying the key function //to the string value of each of the nodes in the argument node-set. //When the second argument to key is of any other type, the argument is //converted to a string as if by a call to the string function; it //returns a node-set containing the nodes in the same document as //the context node that have a value for the named key equal to this string. List<XPathNavigator> indexedNodes = null; if (keyValue is XPathNodeIterator) { XPathNodeIterator nodes = keyValue as XPathNodeIterator; while (nodes.MoveNext()) { IList<XPathNavigator> chunkOfIndexedNodes = index[nodes.Current.Value]; if (chunkOfIndexedNodes != null) { if (indexedNodes == null) indexedNodes = new List<XPathNavigator>(); indexedNodes.AddRange(chunkOfIndexedNodes); } } } else { indexedNodes = index[keyValue.ToString()]; } if (indexedNodes == null) indexedNodes = new List<XPathNavigator>(0); return (XPathNodeIterator) Activator.CreateInstance( arrayIteratorType, BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, null, new object[]{indexedNodes}, null ); } /// <summary> /// Matches given node against "match" pattern and adds it to /// the index table if the matching succeeded. /// </summary> /// <param name="node">Node to match</param> public void MatchNode(XPathNavigator node) { foreach (KeyDef keyDef in keys) { if (node.Matches(keyDef.MatchExpr)) { //Ok, let's calculate key value(s). As per XSLT spec: //If the result is a node-set, then for each node in the node-set, //the node that matches the pattern has a key of the specified name whose //value is the string-value of the node in the node-set; otherwise, the result //is converted to a string, and the node that matches the pattern has a //key of the specified name with value equal to that string. object key = node.Evaluate(keyDef.UseExpr); if (key is XPathNodeIterator) { XPathNodeIterator ni = (XPathNodeIterator)key; while (ni.MoveNext()) AddNodeToIndex(node, ni.Current.Value); } else { AddNodeToIndex(node, key.ToString()); } } } } /// <summary> /// Adds node to the index slot according to key value. /// </summary> /// <param name="node">Node to add to index</param> /// <param name="key">String key value</param> private void AddNodeToIndex(XPathNavigator node, string key) { //Get slot List<XPathNavigator> indexedNodes = index[key]; if (indexedNodes == null) { indexedNodes = new List<XPathNavigator>(); index.Add(key, indexedNodes); } indexedNodes.Add(node.Clone()); } } #endregion XPathNavigatorIndex #region XPathNavigatorIndexManager /// <summary> /// Index manager. Manages collection of named indexes. /// </summary> private class XPathNavigatorIndexManager { private IDictionary<string, XPathNavigatorIndex> indexes; private XPathNavigator nav; private bool indexed; /// <summary> /// Adds new key to the named index. /// </summary> /// <param name="nav">XPathNavigator over XML document to be indexed</param> /// <param name="indexName">Index name</param> /// <param name="key">Key definition</param> public void AddKey(XPathNavigator nav, string indexName, KeyDef key) { this.indexed = false; this.nav = nav; //Named indexes are stored in a hashtable. if (indexes == null) indexes = new Dictionary<string, XPathNavigatorIndex>(); XPathNavigatorIndex index = indexes[indexName]; if (index == null) { index = new XPathNavigatorIndex(); indexes.Add(indexName, index); } index.AddKey(key); } /// <summary> /// Builds indexes. /// </summary> public void BuildIndexes() { XPathNavigator doc = nav.Clone(); //Walk through the all document nodes adding each one matching //'match' expression to the index. doc.MoveToRoot(); //Select all nodes but namespaces and attributes XPathNodeIterator ni = doc.SelectDescendants(XPathNodeType.All, true); while (ni.MoveNext()) { if (ni.Current.NodeType == XPathNodeType.Element) { //Processs namespace nodes if (ni.Current.MoveToFirstNamespace()) { do { foreach (XPathNavigatorIndex index in indexes.Values) index.MatchNode(ni.Current); } while (ni.Current.MoveToNextNamespace()); ni.Current.MoveToParent(); } //process attributes if (ni.Current.MoveToFirstAttribute()) { do { foreach (XPathNavigatorIndex index in indexes.Values) index.MatchNode(ni.Current); } while (ni.Current.MoveToNextAttribute()); ni.Current.MoveToParent(); } } foreach (XPathNavigatorIndex index in indexes.Values) index.MatchNode(ni.Current); } indexed = true; } /// <summary> /// Get indexed nodes by index name and key value. /// </summary> /// <param name="indexName">Index name</param> /// <param name="value">Key value</param> /// <returns>Indexed nodes</returns> public XPathNodeIterator GetNodes(string indexName, object value) { if (!indexed) BuildIndexes(); XPathNavigatorIndex index = indexes[indexName]; return index == null? null : index.GetNodes(value); } } #endregion XPathNavigatorIndexManager #endregion Internal classes } } --- NEW FILE: IHasXPathNavigator.cs --- #region usage using System.Xml.XPath; #endregion namespace Mvp.Xml.Common.XPath { /// <summary> /// Enables a class to return an XPathNavigator from the current context or position. /// </summary> public interface IHasXPathNavigator { /// <summary> /// Returns the XPathNavigator for the current context or position. /// </summary> XPathNavigator GetNavigator(); } } --- NEW FILE: XPathCache.cs --- #region using using System; using System.Collections; using System.Xml; using System.Xml.XPath; #endregion using namespace Mvp.Xml.Common.XPath { /// <summary> /// Implements a cache of XPath queries, for faster execution. /// </summary> /// <remarks> /// Discussed at http://weblogs.asp.net/cazzu/archive/2004/04/02/106667.aspx /// <para>Author: Daniel Cazzulino, kz...@gm...</para> /// </remarks> public sealed class XPathCache { #region Ctor private XPathCache() { } #endregion Ctor #region Private Members /// <summary> /// Initially a simple hashtable. In the future should /// implement sliding expiration of unused expressions. /// </summary> private static IDictionary Cache { get { return _cache; } } static IDictionary _cache = new Hashtable(); /// <summary> /// Retrieves a cached compiled expression, or a newly compiled one. /// </summary> private static XPathExpression GetCompiledExpression(string expression, XPathNavigator source) { XPathExpression expr = (XPathExpression) Cache[expression]; // No double checks. At most we will compile twice. No big deal. if (expr == null) { expr = source.Compile(expression); Cache[expression] = expr; } return expr.Clone(); } /// <summary> /// Sets up the context for expression execution. /// </summary> private static XmlNamespaceManager PrepareContext(XPathNavigator source, XmlNamespaceManager context, XmlPrefix[] prefixes, XPathVariable[] variables) { XmlNamespaceManager ctx = context; // If we have variables, we need the dynamic context. if (variables != null) { DynamicContext dyn; if (ctx != null) dyn = new DynamicContext(ctx); else dyn = new DynamicContext(); // Add the variables we received. foreach (XPathVariable var in variables) { dyn.AddVariable(var.Name, var.Value); } ctx = dyn; } // If prefixes were added, append them to context. if (prefixes != null) { if (ctx == null) ctx = new XmlNamespaceManager(source.NameTable); foreach (XmlPrefix prefix in prefixes) ctx.AddNamespace(prefix.Prefix, prefix.NamespaceURI); } return ctx; } #region PrepareSort private static void PrepareSort(XPathExpression expression, XPathNavigator source, object sortExpression, XmlSortOrder order, XmlCaseOrder caseOrder, string lang, XmlDataType dataType) { if (sortExpression is string) { expression.AddSort( GetCompiledExpression((string)sortExpression, source), order, caseOrder, lang, dataType); } else if (sortExpression is XPathExpression) { expression.AddSort(sortExpression, order, caseOrder, lang, dataType); } else { throw new XPathException(SR.XPathCache_BadSortObject, null); } } private static void PrepareSort(XPathExpression expression, XPathNavigator source, object sortExpression, XmlSortOrder order, XmlCaseOrder caseOrder, string lang, XmlDataType dataType, XmlNamespaceManager context ) { XPathExpression se; if (sortExpression is string) { se = GetCompiledExpression((string)sortExpression, source); } else if (sortExpression is XPathExpression) { se = (XPathExpression) sortExpression; } else { throw new XPathException(SR.XPathCache_BadSortObject, null); } se.SetContext( context ); expression.AddSort(se, order, caseOrder, lang, dataType); } private static void PrepareSort(XPathExpression expression, XPathNavigator source, object sortExpression, IComparer comparer) { if (sortExpression is string) { expression.AddSort( GetCompiledExpression((string)sortExpression, source), comparer); } else if (sortExpression is XPathExpression) { expression.AddSort(sortExpression, comparer); } else { throw new XPathException(SR.XPathCache_BadSortObject, null); } } private static void PrepareSort(XPathExpression expression, XPathNavigator source, object sortExpression, IComparer comparer, XmlNamespaceManager context ) { XPathExpression se; if (sortExpression is string) { se = GetCompiledExpression((string)sortExpression, source); } else if (sortExpression is XPathExpression) { se = (XPathExpression) sortExpression; } else { throw new XPathException(SR.XPathCache_BadSortObject, null); } se.SetContext( context ); expression.AddSort(se, comparer); } #endregion PrepareSort #endregion Private Members #region Evaluate Overloads /// <summary> /// Evaluates the given expression and returns the typed result. /// </summary> public static object Evaluate(string expression, XPathNavigator source) { return source.Evaluate(GetCompiledExpression(expression, source)); } /// <summary> /// Evaluates the given expression and returns the typed result. /// </summary> public static object Evaluate(string expression, XPathNavigator source, params XPathVariable[] variables) { XPathExpression expr = GetCompiledExpression(expression, source); expr.SetContext(PrepareContext(source, null, null, variables)); return source.Evaluate(expr); } /// <summary> /// Evaluates the given expression and returns the typed result. /// </summary> public static object Evaluate(string expression, XPathNavigator source, XmlNamespaceManager context) { XPathExpression expr = GetCompiledExpression(expression, source); expr.SetContext(context); return source.Evaluate(expr); } /// <summary> /// Evaluates the given expression and returns the typed result. /// </summary> public static object Evaluate(string expression, XPathNavigator source, params XmlPrefix[] prefixes) { XPathExpression expr = GetCompiledExpression(expression, source); expr.SetContext(PrepareContext(source, null, prefixes, null)); return source.Evaluate(expr); } /// <summary> /// Evaluates the given expression and returns the typed result. /// </summary> public static object Evaluate(string expression, XPathNavigator source, XmlNamespaceManager context, params XPathVariable[] variables) { XPathExpression expr = GetCompiledExpression(expression, source); expr.SetContext(PrepareContext(source, context, null, variables)); return source.Evaluate(expr); } /// <summary> /// Evaluates the given expression and returns the typed result. /// </summary> public static object Evaluate(string expression, XPathNavigator source, XmlPrefix[] prefixes, params XPathVariable[] variables) { XPathExpression expr = GetCompiledExpression(expression, source); expr.SetContext(PrepareContext(source, null, prefixes, variables)); return source.Evaluate(expr); } #endregion Evaluate Overloads #region Select Overloads /// <summary> /// Selects a node set using the specified XPath expression. /// </summary> public static XPathNodeIterator Select(string expression, XPathNavigator source) { return source.Select(GetCompiledExpression(expression, source)); } /// <summary> /// Selects a node set using the specified XPath expression. /// </summary> public static XPathNodeIterator Select(string expression, XPathNavigator source, params XPathVariable[] variables) { XPathExpression expr = GetCompiledExpression(expression, source); expr.SetContext(PrepareContext(source, null, null, variables)); return source.Select(expr); } /// <summary> /// Selects a node set using the specified XPath expression. /// </summary> public static XPathNodeIterator Select(string expression, XPathNavigator source, XmlNamespaceManager context) { XPathExpression expr = GetCompiledExpression(expression, source); expr.SetContext(context); return source.Select(expr); } /// <summary> /// Selects a node set using the specified XPath expression. /// </summary> public static XPathNodeIterator Select(string expression, XPathNavigator source, params XmlPrefix[] prefixes ) { XPathExpression expr = GetCompiledExpression(expression, source); expr.SetContext(PrepareContext(source, null, prefixes, null)); return source.Select(expr); } /// <summary> /// Selects a node set using the specified XPath expression. /// </summary> public static XPathNodeIterator Select(string expression, XPathNavigator source, XmlNamespaceManager context, params XPathVariable[] variables) { XPathExpression expr = GetCompiledExpression(expression, source); expr.SetContext(PrepareContext(source, context, null, variables)); return source.Select(expr); } /// <summary> /// Selects a node set using the specified XPath expression. /// </summary> public static XPathNodeIterator Select(string expression, XPathNavigator source, XmlPrefix[] prefixes, params XPathVariable[] variables) { XPathExpression expr = GetCompiledExpression(expression, source); expr.SetContext(PrepareContext(source, null, prefixes, variables)); return source.Select(expr); } #endregion Select Overloads #region Sorted Select Overloads /// <summary> /// Selects a node set using the specified XPath expression and sort. /// </summary> /// <remarks> /// See <see cref="XPathExpression.AddSort(object, IComparer)"/>. /// </remarks> public static XPathNodeIterator SelectSorted(string expression, XPathNavigator source, object sortExpression, IComparer comparer) { XPathExpression expr = GetCompiledExpression(expression, source); PrepareSort(expr, source, sortExpression, comparer); return source.Select(expr); } /// <summary> /// Selects a node set using the specified XPath expression and sort. /// </summary> /// <remarks> /// See <see cref="XPathExpression.AddSort(object, IComparer)"/>. /// </remarks> public static XPathNodeIterator SelectSorted(string expression, XPathNavigator source, object sortExpression, XmlSortOrder order, XmlCaseOrder caseOrder, string lang, XmlDataType dataType ) { XPathExpression expr = GetCompiledExpression(expression, source); PrepareSort(expr, source, sortExpression, order, caseOrder, lang, dataType); return source.Select(expr); } /// <summary> /// Selects a node set using the specified XPath expression. /// </summary> public static XPathNodeIterator SelectSorted(string expression, XPathNavigator source, object sortExpression, IComparer comparer, params XPathVariable[] variables) { XPathExpression expr = GetCompiledExpression(expression, source); expr.SetContext(PrepareContext(source, null, null, variables)); PrepareSort(expr, source, sortExpression, comparer); return source.Select(expr); } /// <summary> /// Selects a node set using the specified XPath expression. /// </summary> public static XPathNodeIterator SelectSorted(string expression, XPathNavigator source, object sortExpression, XmlSortOrder order, XmlCaseOrder caseOrder, string lang, XmlDataType dataType, params XPathVariable[] variables) { XPathExpression expr = GetCompiledExpression(expression, source); expr.SetContext(PrepareContext(source, null, null, variables)); PrepareSort(expr, source, sortExpression, order, caseOrder, lang, dataType); return source.Select(expr); } /// <summary> /// Selects a node set using the specified XPath expression. /// </summary> public static XPathNodeIterator SelectSorted(string expression, XPathNavigator source, object sortExpression, XmlSortOrder order, XmlCaseOrder caseOrder, string lang, XmlDataType dataType, XmlNamespaceManager context) { XPathExpression expr = GetCompiledExpression(expression, source); expr.SetContext(context); PrepareSort(expr, source, sortExpression, order, caseOrder, lang, dataType, contex... [truncated message content] |
From: Oleg T. <he...@us...> - 2005-10-19 14:41:10
|
Update of /cvsroot/mvp-xml/Common/v2/src/XPath In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27655/XPath Log Message: Directory /cvsroot/mvp-xml/Common/v2/src/XPath added to the repository |
From: Oleg T. <he...@us...> - 2005-10-19 14:40:16
|
Update of /cvsroot/mvp-xml/Common/v2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27365/v2/src Modified Files: Common.csproj Log Message: Index: Common.csproj =================================================================== RCS file: /cvsroot/mvp-xml/Common/v2/src/Common.csproj,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Common.csproj 16 Oct 2005 16:51:24 -0000 1.1 +++ Common.csproj 19 Oct 2005 14:39:55 -0000 1.2 @@ -11,7 +11,8 @@ <AssemblyKeyContainerName> </AssemblyKeyContainerName> <AssemblyName>Mvp.Xml.Common</AssemblyName> - <AssemblyOriginatorKeyFile>mvp-xml.snk</AssemblyOriginatorKeyFile> + <AssemblyOriginatorKeyFile> + </AssemblyOriginatorKeyFile> <DefaultClientScript>JScript</DefaultClientScript> <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> <DefaultTargetSchema>IE50</DefaultTargetSchema> @@ -140,9 +141,6 @@ <DependentUpon>SR.cs</DependentUpon> </EmbeddedResource> </ItemGroup> - <ItemGroup> - <None Include="mvp-xml.snk" /> - </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <PropertyGroup> <PreBuildEvent> |
From: Oleg T. <he...@us...> - 2005-10-19 13:27:23
|
Update of /cvsroot/mvp-xml/Common/v1/src/XPath In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10950/v1/src/XPath Modified Files: IndexingXPathNavigator.cs XPathCache.cs XPathIteratorReader.cs Log Message: Index: XPathCache.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v1/src/XPath/XPathCache.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- XPathCache.cs 16 Oct 2005 16:51:24 -0000 1.4 +++ XPathCache.cs 19 Oct 2005 13:27:10 -0000 1.5 @@ -319,7 +319,7 @@ /// Selects a node set using the specified XPath expression and sort. /// </summary> /// <remarks> - /// See <see cref="XPathExpression.AddSort(object, IComparer)"/>. + /// See <see cref="XPathExpression.AddSort"/>. /// </remarks> public static XPathNodeIterator SelectSorted(string expression, XPathNavigator source, object sortExpression, IComparer comparer) @@ -333,7 +333,7 @@ /// Selects a node set using the specified XPath expression and sort. /// </summary> /// <remarks> - /// See <see cref="XPathExpression.AddSort(object, IComparer)"/>. + /// See <see cref="XPathExpression.AddSort"/>. /// </remarks> public static XPathNodeIterator SelectSorted(string expression, XPathNavigator source, object sortExpression, XmlSortOrder order, XmlCaseOrder caseOrder, string lang, XmlDataType dataType ) @@ -531,7 +531,7 @@ /// Selects a node set using the specified XPath expression and sort. /// </summary> /// <remarks> - /// See <see cref="XPathExpression.AddSort(object, IComparer)"/>. + /// See <see cref="XPathExpression.AddSort"/>. /// </remarks> public static XmlNodeList SelectNodesSorted(string expression, XmlNode source, object sortExpression, IComparer comparer) @@ -544,7 +544,7 @@ /// Selects a node set using the specified XPath expression and sort. /// </summary> /// <remarks> - /// See <see cref="XPathExpression.AddSort(object, IComparer)"/>. + /// See <see cref="XPathExpression.AddSort"/>. /// </remarks> public static XmlNodeList SelectNodesSorted(string expression, XmlNode source, object sortExpression, XmlSortOrder order, XmlCaseOrder caseOrder, string lang, XmlDataType dataType ) Index: XPathIteratorReader.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v1/src/XPath/XPathIteratorReader.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- XPathIteratorReader.cs 16 Oct 2005 16:51:24 -0000 1.3 +++ XPathIteratorReader.cs 19 Oct 2005 13:27:10 -0000 1.4 @@ -143,19 +143,19 @@ get { return _current.IsEmptyElement; } } - /// <summary>See <see cref="XmlReader.this[string, string]"/></summary> + /// <summary>See <see cref="XmlReader.this"/></summary> public override string this[string name, string ns] { get { return _current[name, ns]; } } - /// <summary>See <see cref="XmlReader.this[string]"/></summary> + /// <summary>See <see cref="XmlReader.this"/></summary> public override string this[string name] { get { return _current[name, String.Empty]; } } - /// <summary>See <see cref="XmlReader.this[int]"/></summary> + /// <summary>See <see cref="XmlReader.this"/></summary> public override string this[int i] { get { return _current[i]; } @@ -238,19 +238,19 @@ _current.Close(); } - /// <summary>See <see cref="XmlReader.GetAttribute(string, string)"/></summary> + /// <summary>See <see cref="XmlReader.GetAttribute"/></summary> public override string GetAttribute(string name, string ns) { return _current.GetAttribute(name, ns); } - /// <summary>See <see cref="XmlReader.GetAttribute(string)"/></summary> + /// <summary>See <see cref="XmlReader.GetAttribute"/></summary> public override string GetAttribute(string name) { return _current.GetAttribute(name); } - /// <summary>See <see cref="XmlReader.GetAttribute(int)"/></summary> + /// <summary>See <see cref="XmlReader.GetAttribute"/></summary> public override string GetAttribute(int i) { return _current.GetAttribute(i); @@ -262,19 +262,19 @@ return _current.LookupNamespace(prefix); } - /// <summary>See <see cref="XmlReader.MoveToAttribute(string, string)"/></summary> + /// <summary>See <see cref="XmlReader.MoveToAttribute"/></summary> public override bool MoveToAttribute(string name, string ns) { return _current.MoveToAttribute(name, ns); } - /// <summary>See <see cref="XmlReader.MoveToAttribute(string)"/></summary> + /// <summary>See <see cref="XmlReader.MoveToAttribute"/></summary> public override bool MoveToAttribute(string name) { return _current.MoveToAttribute(name); } - /// <summary>See <see cref="XmlReader.MoveToAttribute(int)"/></summary> + /// <summary>See <see cref="XmlReader.MoveToAttribute"/></summary> public override void MoveToAttribute(int i) { _current.MoveToAttribute(i); @@ -318,7 +318,7 @@ if (read) { // Just move to the next node and create the reader. - _current = _iterator.Current.ReadSubtree(); + _current = new XPathNavigatorReader(_iterator.Current); return _current.Read(); } else @@ -464,20 +464,20 @@ { get { return false; } } - - /// <summary>See <see cref="XmlReader.this[string, string]"/></summary> + + /// <summary>See <see cref="XmlReader.this"/></summary> public override string this[string name, string ns] { get { return null; } } - /// <summary>See <see cref="XmlReader.this[string]"/></summary> + /// <summary>See <see cref="XmlReader.this"/></summary> public override string this[string name] { get { return null; } } - /// <summary>See <see cref="XmlReader.this[string]"/></summary> + /// <summary>See <see cref="XmlReader.this"/></summary> public override string this[int i] { get { return null; } @@ -559,19 +559,19 @@ _state = ReadState.Closed; } - /// <summary>See <see cref="XmlReader.GetAttribute(string, string)"/></summary> + /// <summary>See <see cref="XmlReader.GetAttribute"/></summary> public override string GetAttribute(string name, string ns) { return null; } - /// <summary>See <see cref="XmlReader.GetAttribute(string)"/></summary> + /// <summary>See <see cref="XmlReader.GetAttribute"/></summary> public override string GetAttribute(string name) { return null; } - /// <summary>See <see cref="XmlReader.GetAttribute(int)"/></summary> + /// <summary>See <see cref="XmlReader.GetAttribute"/></summary> public override string GetAttribute(int i) { return null; @@ -583,19 +583,19 @@ return null; } - /// <summary>See <see cref="XmlReader.MoveToAttribute(string, string)"/></summary> + /// <summary>See <see cref="XmlReader.MoveToAttribute"/></summary> public override bool MoveToAttribute(string name, string ns) { return false; } - /// <summary>See <see cref="XmlReader.MoveToAttribute(string)"/></summary> + /// <summary>See <see cref="XmlReader.MoveToAttribute"/></summary> public override bool MoveToAttribute(string name) { return false; } - /// <summary>See <see cref="XmlReader.MoveToAttribute(int)"/></summary> + /// <summary>See <see cref="XmlReader.MoveToAttribute"/></summary> public override void MoveToAttribute(int i) { } Index: IndexingXPathNavigator.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v1/src/XPath/IndexingXPathNavigator.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- IndexingXPathNavigator.cs 16 Oct 2005 16:51:24 -0000 1.3 +++ IndexingXPathNavigator.cs 19 Oct 2005 13:27:10 -0000 1.4 @@ -1,7 +1,7 @@ #region using using System; -using System.Collections.Generic; +using System.Collections; using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; @@ -150,7 +150,7 @@ } /// <summary> - /// See <see cref="XPathItem.Value"/>. + /// See <see cref="XPathNavigator.Value"/>. /// </summary> public override string Value { @@ -246,7 +246,7 @@ } /// <summary> - /// See <see cref="XPathNavigator.MoveToFirstNamespace(XPathNamespaceScope)"/>. + /// See <see cref="XPathNavigator.MoveToFirstNamespace"/>. /// </summary> public override bool MoveToFirstNamespace(XPathNamespaceScope namespaceScope) { @@ -254,7 +254,7 @@ } /// <summary> - /// See <see cref="XPathNavigator.MoveToNextNamespace(XPathNamespaceScope)"/>. + /// See <see cref="XPathNavigator.MoveToNextNamespace"/>. /// </summary> public override bool MoveToNextNamespace(XPathNamespaceScope namespaceScope) { @@ -262,7 +262,7 @@ } /// <summary> - /// See <see cref="XPathNavigator.MoveToNext()"/>. + /// See <see cref="XPathNavigator.MoveToNext"/>. /// </summary> public override bool MoveToNext() { @@ -585,8 +585,8 @@ /// </summary> private class XPathNavigatorIndex { - private IList<KeyDef> keys; - private IDictionary<string, List<XPathNavigator>> index; + private ArrayList keys; + private Hashtable index; private Type arrayIteratorType; /// <summary> @@ -594,8 +594,8 @@ /// </summary> public XPathNavigatorIndex() { - keys = new List<KeyDef>(); - index = new Dictionary<string, List<XPathNavigator>>(); + keys = new ArrayList(); + index = new Hashtable(); Assembly systemXml = typeof(XPathNodeIterator).Assembly; // TODO: is there another way? arrayIteratorType = systemXml.GetType("System.Xml.XPath.XPathArrayIterator"); @@ -624,27 +624,27 @@ //converted to a string as if by a call to the string function; it //returns a node-set containing the nodes in the same document as //the context node that have a value for the named key equal to this string. - List<XPathNavigator> indexedNodes = null; + ArrayList indexedNodes = null; if (keyValue is XPathNodeIterator) { XPathNodeIterator nodes = keyValue as XPathNodeIterator; while (nodes.MoveNext()) - { - IList<XPathNavigator> chunkOfIndexedNodes = index[nodes.Current.Value]; + { + ArrayList chunkOfIndexedNodes = (ArrayList)index[nodes.Current.Value]; if (chunkOfIndexedNodes != null) { if (indexedNodes == null) - indexedNodes = new List<XPathNavigator>(); + indexedNodes = new ArrayList(); indexedNodes.AddRange(chunkOfIndexedNodes); } } } else { - indexedNodes = index[keyValue.ToString()]; + indexedNodes = (ArrayList)index[keyValue.ToString()]; } if (indexedNodes == null) - indexedNodes = new List<XPathNavigator>(0); + indexedNodes = new ArrayList(0); return (XPathNodeIterator) Activator.CreateInstance( arrayIteratorType, BindingFlags.Instance | BindingFlags.Public | @@ -691,10 +691,10 @@ private void AddNodeToIndex(XPathNavigator node, string key) { //Get slot - List<XPathNavigator> indexedNodes = index[key]; + ArrayList indexedNodes = (ArrayList)index[key]; if (indexedNodes == null) { - indexedNodes = new List<XPathNavigator>(); + indexedNodes = new ArrayList(); index.Add(key, indexedNodes); } indexedNodes.Add(node.Clone()); @@ -710,7 +710,7 @@ /// </summary> private class XPathNavigatorIndexManager { - private IDictionary<string, XPathNavigatorIndex> indexes; + private Hashtable indexes; private XPathNavigator nav; private bool indexed; @@ -726,8 +726,8 @@ this.nav = nav; //Named indexes are stored in a hashtable. if (indexes == null) - indexes = new Dictionary<string, XPathNavigatorIndex>(); - XPathNavigatorIndex index = indexes[indexName]; + indexes = new Hashtable(); + XPathNavigatorIndex index = (XPathNavigatorIndex)indexes[indexName]; if (index == null) { index = new XPathNavigatorIndex(); @@ -790,7 +790,7 @@ { if (!indexed) BuildIndexes(); - XPathNavigatorIndex index = indexes[indexName]; + XPathNavigatorIndex index = (XPathNavigatorIndex)indexes[indexName]; return index == null? null : index.GetNodes(value); } } |
From: Oleg T. <he...@us...> - 2005-10-19 13:21:06
|
Update of /cvsroot/mvp-xml/Common/v1/src/XPath In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8833/v1/src/XPath Modified Files: SubtreeeXPathNavigator.cs Log Message: Index: SubtreeeXPathNavigator.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v1/src/XPath/SubtreeeXPathNavigator.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- SubtreeeXPathNavigator.cs 16 Oct 2005 16:51:24 -0000 1.3 +++ SubtreeeXPathNavigator.cs 19 Oct 2005 13:20:47 -0000 1.4 @@ -176,7 +176,7 @@ } /// <summary> - /// See <see cref="XPathItem.Value"/>. + /// See <see cref="XPathNavigator.Value"/>. /// </summary> public override string Value { @@ -276,7 +276,7 @@ } /// <summary> - /// See <see cref="XPathNavigator.MoveToNext()"/>. + /// See <see cref="XPathNavigator.MoveToNext"/>. /// </summary> public override bool MoveToNext() { @@ -401,7 +401,7 @@ } /// <summary> - /// See <see cref="XPathNavigator.MoveToFirstNamespace(XPathNamespaceScope)"/>. + /// See <see cref="XPathNavigator.MoveToFirstNamespace"/>. /// </summary> public override bool MoveToFirstNamespace(XPathNamespaceScope namespaceScope) { @@ -409,7 +409,7 @@ } /// <summary> - /// See <see cref="XPathNavigator.MoveToNextNamespace(XPathNamespaceScope)"/>. + /// See <see cref="XPathNavigator.MoveToNextNamespace"/>. /// </summary> public override bool MoveToNextNamespace(XPathNamespaceScope namespaceScope) { |
From: Oleg T. <he...@us...> - 2005-10-19 13:18:28
|
Update of /cvsroot/mvp-xml/Common/v1/src/XPath In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8075/v1/src/XPath Modified Files: DynamicContext.cs Log Message: Index: DynamicContext.cs =================================================================== RCS file: /cvsroot/mvp-xml/Common/v1/src/XPath/DynamicContext.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- DynamicContext.cs 16 Oct 2005 16:51:24 -0000 1.3 +++ DynamicContext.cs 19 Oct 2005 13:18:19 -0000 1.4 @@ -1,7 +1,7 @@ #region using using System; -using System.Collections.Generic; +using System.Collections; using System.Reflection; using System.Text; using System.Xml; @@ -25,7 +25,7 @@ { #region Private vars - IDictionary<string, DynamicVariable> _variables = new Dictionary<string, DynamicVariable>(); + Hashtable _variables = new Hashtable(); #endregion Private @@ -84,7 +84,7 @@ #region Common Overrides /// <summary> - /// Implementation equal to <see cref="XsltContext.CompareDocument(string, string)"/>. + /// Implementation equal to <see cref="XsltCompileContext"/>. /// </summary> public override int CompareDocument(string baseUri, string nextbaseUri) { @@ -116,7 +116,7 @@ } /// <summary> - /// Same as <see cref="XsltContext.PreserveWhitespace(XPathNavigator)"/>. + /// Same as <see cref="XsltCompileContext"/>. /// </summary> public override bool PreserveWhitespace(XPathNavigator node) { @@ -124,7 +124,7 @@ } /// <summary> - /// Same as <see cref="XsltContext.Whitespace"/>. + /// Same as <see cref="XsltCompileContext"/>. /// </summary> public override bool Whitespace { |
From: Oleg T. <he...@us...> - 2005-10-17 11:03:59
|
Update of /cvsroot/mvp-xml/EXSLT/v2/src/Exslt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6152/v2/src/Exslt Modified Files: ExsltContext.cs ExsltNodeList.cs ExsltSets.cs Log Message: Index: ExsltContext.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v2/src/Exslt/ExsltContext.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ExsltContext.cs 16 Oct 2005 20:07:08 -0000 1.1 +++ ExsltContext.cs 17 Oct 2005 11:03:48 -0000 1.2 @@ -4,328 +4,343 @@ using System.Xml.Xsl; using System.Xml; using System.Xml.XPath; -using System.Reflection; #endregion -namespace Mvp.Xml.Exslt +namespace Mvp.Xml.Exslt { - /// <summary> - /// Custom XsltContext for resolving EXSLT functions in - /// XPath-only environment. - /// </summary> - public class ExsltContext : XsltContext { - - #region Private Fields and Properties - - private XmlNameTable _nt; - - /// <summary> - /// Bitwise enumeration used to specify which EXSLT functions should be accessible to - /// in the ExsltContext object. The default value is ExsltFunctionNamespace.All - /// </summary> - private ExsltFunctionNamespace _supportedFunctions = ExsltFunctionNamespace.All; + /// <summary> + /// Custom XsltContext for resolving EXSLT functions in + /// XPath-only environment. + /// </summary> + public class ExsltContext : XsltContext + { - /// <summary> - /// Extension object which implements the functions in the http://exslt.org/math namespace - /// </summary> - private ExsltMath exsltMath = new ExsltMath(); + #region Private Fields and Properties - - /// <summary> - /// Extension object which implements the functions in the http://exslt.org/dates-and-times namespace - /// </summary> - private ExsltDatesAndTimes exsltDatesAndTimes = new ExsltDatesAndTimes(); + private XmlNameTable _nt; - /// <summary> - /// Extension object which implements the functions in the http://exslt.org/regular-expressions namespace - /// </summary> - private ExsltRegularExpressions exsltRegularExpressions = new ExsltRegularExpressions(); + /// <summary> + /// Bitwise enumeration used to specify which EXSLT functions should be accessible to + /// in the ExsltContext object. The default value is ExsltFunctionNamespace.All + /// </summary> + private ExsltFunctionNamespace _supportedFunctions = ExsltFunctionNamespace.All; - /// <summary> - /// Extension object which implements the functions in the http://exslt.org/strings namespace - /// </summary> - private ExsltStrings exsltStrings = new ExsltStrings(); + /// <summary> + /// Extension object which implements the functions in the http://exslt.org/math namespace + /// </summary> + private ExsltMath exsltMath = new ExsltMath(); - /// <summary> - /// Extension object which implements the functions in the http://exslt.org/sets namespace - /// </summary> - private ExsltSets exsltSets = new ExsltSets(); - /// <summary> - /// Extension object which implements the functions in the http://exslt.org/random namespace - /// </summary> - private ExsltRandom exsltRandom = new ExsltRandom(); + /// <summary> + /// Extension object which implements the functions in the http://exslt.org/dates-and-times namespace + /// </summary> + private ExsltDatesAndTimes exsltDatesAndTimes = new ExsltDatesAndTimes(); - /// <summary> - /// Extension object which implements the functions in the http://gotdotnet.com/exslt/dates-and-times namespace - /// </summary> - private GDNDatesAndTimes gdnDatesAndTimes = new GDNDatesAndTimes(); - - /// <summary> - /// Extension object which implements the functions in the http://gotdotnet.com/exslt/regular-expressions namespace - /// </summary> - private GDNRegularExpressions gdnRegularExpressions = new GDNRegularExpressions(); - - /// <summary> - /// Extension object which implements the functions in the http://gotdotnet.com/exslt/math namespace - /// </summary> - private GDNMath gdnMath = new GDNMath(); - - /// <summary> - /// Extension object which implements the functions in the http://gotdotnet.com/exslt/sets namespace - /// </summary> - private GDNSets gdnSets = new GDNSets(); - - /// <summary> - /// Extension object which implements the functions in the http://gotdotnet.com/exslt/strings namespace - /// </summary> - private GDNStrings gdnStrings = new GDNStrings(); + /// <summary> + /// Extension object which implements the functions in the http://exslt.org/regular-expressions namespace + /// </summary> + private ExsltRegularExpressions exsltRegularExpressions = new ExsltRegularExpressions(); - /// <summary> - /// Extension object which implements the functions in the http://gotdotnet.com/exslt/dynamic namespace - /// </summary> - private GDNDynamic gdnDynamic = new GDNDynamic(); - - #endregion - - #region Constructors - - public ExsltContext(XmlNameTable nt) : base((NameTable)nt) { - _nt = nt; - AddExtensionNamespaces(); - } - - public ExsltContext(NameTable nt, ExsltFunctionNamespace supportedFunctions) - : this(nt) { - SupportedFunctions = supportedFunctions; - } - - #endregion + /// <summary> + /// Extension object which implements the functions in the http://exslt.org/strings namespace + /// </summary> + private ExsltStrings exsltStrings = new ExsltStrings(); - #region Private methods - private void AddExtensionNamespaces() - { - //remove all our extension objects in case the ExsltContext is being reused - RemoveNamespace("math", ExsltNamespaces.Math); - RemoveNamespace("date", ExsltNamespaces.DatesAndTimes); - RemoveNamespace("regexp", ExsltNamespaces.RegularExpressions); - RemoveNamespace("str", ExsltNamespaces.Strings); - RemoveNamespace("set", ExsltNamespaces.Sets); - RemoveNamespace("random", ExsltNamespaces.Random); - RemoveNamespace("date2", ExsltNamespaces.GDNDatesAndTimes); - RemoveNamespace("math2", ExsltNamespaces.GDNMath); - RemoveNamespace("regexp2", ExsltNamespaces.GDNRegularExpressions); - RemoveNamespace("set2", ExsltNamespaces.GDNSets); - RemoveNamespace("str2", ExsltNamespaces.GDNStrings); - RemoveNamespace("dyn2", ExsltNamespaces.GDNDynamic); + /// <summary> + /// Extension object which implements the functions in the http://exslt.org/sets namespace + /// </summary> + private ExsltSets exsltSets = new ExsltSets(); - //add extension objects as specified by SupportedFunctions - if ((this.SupportedFunctions & ExsltFunctionNamespace.Math) > 0) - AddNamespace("math", ExsltNamespaces.Math); + /// <summary> + /// Extension object which implements the functions in the http://exslt.org/random namespace + /// </summary> + private ExsltRandom exsltRandom = new ExsltRandom(); - if ((this.SupportedFunctions & ExsltFunctionNamespace.DatesAndTimes) > 0) - AddNamespace("date", ExsltNamespaces.DatesAndTimes); + /// <summary> + /// Extension object which implements the functions in the http://gotdotnet.com/exslt/dates-and-times namespace + /// </summary> + private GDNDatesAndTimes gdnDatesAndTimes = new GDNDatesAndTimes(); - if ((this.SupportedFunctions & ExsltFunctionNamespace.RegularExpressions) > 0) - AddNamespace("regexp", ExsltNamespaces.RegularExpressions); + /// <summary> + /// Extension object which implements the functions in the http://gotdotnet.com/exslt/regular-expressions namespace + /// </summary> + private GDNRegularExpressions gdnRegularExpressions = new GDNRegularExpressions(); - if ((this.SupportedFunctions & ExsltFunctionNamespace.Strings) > 0) - AddNamespace("str", ExsltNamespaces.Strings); + /// <summary> + /// Extension object which implements the functions in the http://gotdotnet.com/exslt/math namespace + /// </summary> + private GDNMath gdnMath = new GDNMath(); - if ((this.SupportedFunctions & ExsltFunctionNamespace.Sets) > 0) - AddNamespace("set", ExsltNamespaces.Sets); + /// <summary> + /// Extension object which implements the functions in the http://gotdotnet.com/exslt/sets namespace + /// </summary> + private GDNSets gdnSets = new GDNSets(); - if ((this.SupportedFunctions & ExsltFunctionNamespace.Random) > 0) - AddNamespace("random", ExsltNamespaces.Random); + /// <summary> + /// Extension object which implements the functions in the http://gotdotnet.com/exslt/strings namespace + /// </summary> + private GDNStrings gdnStrings = new GDNStrings(); - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNDatesAndTimes) > 0) - AddNamespace("date2", ExsltNamespaces.GDNDatesAndTimes); + /// <summary> + /// Extension object which implements the functions in the http://gotdotnet.com/exslt/dynamic namespace + /// </summary> + private GDNDynamic gdnDynamic = new GDNDynamic(); - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNMath) > 0) - AddNamespace("math2", ExsltNamespaces.GDNMath); + #endregion - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNRegularExpressions) > 0) - AddNamespace("regexp2", ExsltNamespaces.GDNRegularExpressions); + #region Constructors - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNSets) > 0) - AddNamespace("set2", ExsltNamespaces.GDNSets); + public ExsltContext(XmlNameTable nt) + : base((NameTable)nt) + { + _nt = nt; + AddExtensionNamespaces(); + } - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNStrings) > 0) - AddNamespace("str2", ExsltNamespaces.GDNStrings); + public ExsltContext(NameTable nt, ExsltFunctionNamespace supportedFunctions) + : this(nt) + { + SupportedFunctions = supportedFunctions; + } - if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNDynamic) > 0) - AddNamespace("dyn2", ExsltNamespaces.GDNDynamic); - } - #endregion - - #region Public Properties - /// <summary> - /// Bitwise enumeration used to specify which EXSLT functions should be accessible to - /// in the ExsltContext. The default value is ExsltFunctionNamespace.All - /// </summary> - public ExsltFunctionNamespace SupportedFunctions { - set { - if (Enum.IsDefined(typeof(ExsltFunctionNamespace), value)) - _supportedFunctions = value; - } - get { return _supportedFunctions; } - } - #endregion + #endregion - #region XsltContext Overrides - public override int CompareDocument(string baseUri, string nextbaseUri) - { - return 0; - } + #region Private methods + private void AddExtensionNamespaces() + { + //remove all our extension objects in case the ExsltContext is being reused + RemoveNamespace("math", ExsltNamespaces.Math); + RemoveNamespace("date", ExsltNamespaces.DatesAndTimes); + RemoveNamespace("regexp", ExsltNamespaces.RegularExpressions); + RemoveNamespace("str", ExsltNamespaces.Strings); + RemoveNamespace("set", ExsltNamespaces.Sets); + RemoveNamespace("random", ExsltNamespaces.Random); + RemoveNamespace("date2", ExsltNamespaces.GDNDatesAndTimes); + RemoveNamespace("math2", ExsltNamespaces.GDNMath); + RemoveNamespace("regexp2", ExsltNamespaces.GDNRegularExpressions); + RemoveNamespace("set2", ExsltNamespaces.GDNSets); + RemoveNamespace("str2", ExsltNamespaces.GDNStrings); + RemoveNamespace("dyn2", ExsltNamespaces.GDNDynamic); - public override bool PreserveWhitespace(XPathNavigator node) - { - return true; - } + //add extension objects as specified by SupportedFunctions + if ((this.SupportedFunctions & ExsltFunctionNamespace.Math) > 0) + AddNamespace("math", ExsltNamespaces.Math); - public override bool Whitespace - { - get { return true; } - } + if ((this.SupportedFunctions & ExsltFunctionNamespace.DatesAndTimes) > 0) + AddNamespace("date", ExsltNamespaces.DatesAndTimes); - /// <summary> - /// Resolves variables. - /// </summary> - /// <param name="prefix">The variable's prefix</param> - /// <param name="name">The variable's name</param> - /// <returns></returns> - public override IXsltContextVariable ResolveVariable(string prefix, string name) - { - return null; - } + if ((this.SupportedFunctions & ExsltFunctionNamespace.RegularExpressions) > 0) + AddNamespace("regexp", ExsltNamespaces.RegularExpressions); - /// <summary> - /// Resolves custom function in XPath expression. - /// </summary> - /// <param name="prefix">The prefix of the function as it appears in the XPath expression.</param> - /// <param name="name">The name of the function.</param> - /// <param name="argTypes">An array of argument types for the function being resolved. - /// This allows you to select between methods with the same name (for example, overloaded - /// methods). </param> - /// <returns>An IXsltContextFunction representing the function.</returns> - public override IXsltContextFunction ResolveFunction(string prefix, string name, - XPathResultType[] argTypes) + if ((this.SupportedFunctions & ExsltFunctionNamespace.Strings) > 0) + AddNamespace("str", ExsltNamespaces.Strings); + + if ((this.SupportedFunctions & ExsltFunctionNamespace.Sets) > 0) + AddNamespace("set", ExsltNamespaces.Sets); + + if ((this.SupportedFunctions & ExsltFunctionNamespace.Random) > 0) + AddNamespace("random", ExsltNamespaces.Random); + + if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNDatesAndTimes) > 0) + AddNamespace("date2", ExsltNamespaces.GDNDatesAndTimes); + + if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNMath) > 0) + AddNamespace("math2", ExsltNamespaces.GDNMath); + + if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNRegularExpressions) > 0) + AddNamespace("regexp2", ExsltNamespaces.GDNRegularExpressions); + + if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNSets) > 0) + AddNamespace("set2", ExsltNamespaces.GDNSets); + + if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNStrings) > 0) + AddNamespace("str2", ExsltNamespaces.GDNStrings); + + if ((this.SupportedFunctions & ExsltFunctionNamespace.GDNDynamic) > 0) + AddNamespace("dyn2", ExsltNamespaces.GDNDynamic); + } + #endregion + + #region Public Properties + /// <summary> + /// Bitwise enumeration used to specify which EXSLT functions should be accessible to + /// in the ExsltContext. The default value is ExsltFunctionNamespace.All + /// </summary> + public ExsltFunctionNamespace SupportedFunctions + { + set + { + if (Enum.IsDefined(typeof(ExsltFunctionNamespace), value)) + _supportedFunctions = value; + } + get { return _supportedFunctions; } + } + #endregion + + #region XsltContext Overrides + public override int CompareDocument(string baseUri, string nextbaseUri) + { + return 0; + } + + public override bool PreserveWhitespace(XPathNavigator node) + { + return true; + } + + public override bool Whitespace + { + get { return true; } + } + + /// <summary> + /// Resolves variables. + /// </summary> + /// <param name="prefix">The variable's prefix</param> + /// <param name="name">The variable's name</param> + /// <returns></returns> + public override IXsltContextVariable ResolveVariable(string prefix, string name) + { + return null; + } + + /// <summary> + /// Resolves custom function in XPath expression. + /// </summary> + /// <param name="prefix">The prefix of the function as it appears in the XPath expression.</param> + /// <param name="name">The name of the function.</param> + /// <param name="argTypes">An array of argument types for the function being resolved. + /// This allows you to select between methods with the same name (for example, overloaded + /// methods). </param> + /// <returns>An IXsltContextFunction representing the function.</returns> + public override IXsltContextFunction ResolveFunction(string prefix, string name, + XPathResultType[] argTypes) + { + switch (LookupNamespace(_nt.Get(prefix))) + { + case ExsltNamespaces.DatesAndTimes: + return GetExtensionFunctionImplementation(exsltDatesAndTimes, name, argTypes); + case ExsltNamespaces.Math: + return GetExtensionFunctionImplementation(exsltMath, name, argTypes); + case ExsltNamespaces.RegularExpressions: + return GetExtensionFunctionImplementation(exsltRegularExpressions, name, argTypes); + case ExsltNamespaces.Sets: + return GetExtensionFunctionImplementation(exsltSets, name, argTypes); + case ExsltNamespaces.Strings: + return GetExtensionFunctionImplementation(exsltStrings, name, argTypes); + case ExsltNamespaces.Random: + return GetExtensionFunctionImplementation(exsltRandom, name, argTypes); + case ExsltNamespaces.GDNDatesAndTimes: + return GetExtensionFunctionImplementation(gdnDatesAndTimes, name, argTypes); + case ExsltNamespaces.GDNMath: + return GetExtensionFunctionImplementation(gdnMath, name, argTypes); + case ExsltNamespaces.GDNRegularExpressions: + return GetExtensionFunctionImplementation(gdnRegularExpressions, name, argTypes); + case ExsltNamespaces.GDNSets: + return GetExtensionFunctionImplementation(gdnSets, name, argTypes); + case ExsltNamespaces.GDNStrings: + return GetExtensionFunctionImplementation(gdnStrings, name, argTypes); + case ExsltNamespaces.GDNDynamic: + return GetExtensionFunctionImplementation(gdnDynamic, name, argTypes); + default: + throw new XPathException(string.Format("Unrecognized extension function namespace: prefix='{0}', namespace URI='{1}'", + prefix, LookupNamespace(_nt.Get(prefix))), null); + } + } + #endregion + + /// <summary> + /// Finds appropriate implementation for an extension function - public + /// method with the same number of arguments and compatible argument types. + /// </summary> + /// <param name="obj">Extension object</param> + /// <param name="name">Function name</param> + /// <param name="argTypes">Types of arguments</param> + /// <returns></returns> + private ExsltContextFunction GetExtensionFunctionImplementation(object obj, string name, XPathResultType[] argTypes) + { + //For each method in object's type + foreach (MethodInfo mi in obj.GetType().GetMethods()) + { + //We are interested in methods with given name + if (mi.Name == name) { - switch (LookupNamespace(_nt.Get(prefix))) - { - case ExsltNamespaces.DatesAndTimes: - return GetExtensionFunctionImplementation(exsltDatesAndTimes, name, argTypes); - case ExsltNamespaces.Math: - return GetExtensionFunctionImplementation(exsltMath, name, argTypes); - case ExsltNamespaces.RegularExpressions: - return GetExtensionFunctionImplementation(exsltRegularExpressions, name, argTypes); - case ExsltNamespaces.Sets: - return GetExtensionFunctionImplementation(exsltSets, name, argTypes); - case ExsltNamespaces.Strings: - return GetExtensionFunctionImplementation(exsltStrings, name, argTypes); - case ExsltNamespaces.Random: - return GetExtensionFunctionImplementation(exsltRandom, name, argTypes); - case ExsltNamespaces.GDNDatesAndTimes: - return GetExtensionFunctionImplementation(gdnDatesAndTimes, name, argTypes); - case ExsltNamespaces.GDNMath: - return GetExtensionFunctionImplementation(gdnMath, name, argTypes); - case ExsltNamespaces.GDNRegularExpressions: - return GetExtensionFunctionImplementation(gdnRegularExpressions, name, argTypes); - case ExsltNamespaces.GDNSets: - return GetExtensionFunctionImplementation(gdnSets, name, argTypes); - case ExsltNamespaces.GDNStrings: - return GetExtensionFunctionImplementation(gdnStrings, name, argTypes); - case ExsltNamespaces.GDNDynamic: - return GetExtensionFunctionImplementation(gdnDynamic, name, argTypes); - default: - throw new XPathException(string.Format("Unrecognized extension function namespace: prefix='{0}', namespace URI='{1}'", - prefix, LookupNamespace(_nt.Get(prefix))), null); + ParameterInfo[] parameters = mi.GetParameters(); + ////We are interested in methods with given number of arguments + if (parameters.Length == argTypes.Length) + { + bool mismatch = false; + //Now let's check out if parameter types are compatible with actual ones + for (int i = 0; i < parameters.Length; i++) + { + ParameterInfo pi = parameters[i]; + XPathResultType paramType = ConvertToXPathType(pi.ParameterType); + if (paramType == XPathResultType.Any || paramType == argTypes[i]) + continue; + else + { + mismatch = true; + break; + } } - } - #endregion - - /// <summary> - /// Finds appropriate implementation for an extension function - public - /// method with the same number of arguments and compatible argument types. - /// </summary> - /// <param name="obj">Extension object</param> - /// <param name="name">Function name</param> - /// <param name="argTypes">Types of arguments</param> - /// <returns></returns> - private ExsltContextFunction GetExtensionFunctionImplementation(object obj, string name, XPathResultType[] argTypes) { - //For each method in object's type - foreach (MethodInfo mi in obj.GetType().GetMethods()) { - //We are interested in methods with given name - if (mi.Name == name) { - ParameterInfo[] parameters = mi.GetParameters(); - ////We are interested in methods with given number of arguments - if (parameters.Length == argTypes.Length) { - bool mismatch = false; - //Now let's check out if parameter types are compatible with actual ones - for(int i=0; i<parameters.Length; i++) { - ParameterInfo pi = parameters[i]; - XPathResultType paramType = ConvertToXPathType(pi.ParameterType); - if (paramType == XPathResultType.Any || paramType == argTypes[i]) - continue; - else { - mismatch = true; - break; - } - } - if (!mismatch) - //Create lightweight wrapper around method info - return new ExsltContextFunction(mi, argTypes, obj); - } - } - } - throw new XPathException("Extension function not found: " + name, null); - } - - /// <summary> - /// Converts CLI type to XPathResultType type. - /// </summary> - /// <param name="type"></param> - /// <returns></returns> - public static XPathResultType ConvertToXPathType(Type type) { - switch (Type.GetTypeCode(type)) { - case TypeCode.Boolean: - return XPathResultType.Boolean; - case TypeCode.String: - return XPathResultType.String; - case TypeCode.Object: - if (typeof(IXPathNavigable).IsAssignableFrom(type) || - typeof(XPathNavigator).IsAssignableFrom(type)) - return XPathResultType.Navigator; - else if (typeof(XPathNodeIterator).IsAssignableFrom(type)) - return XPathResultType.NodeSet; - else - return XPathResultType.Any; - case TypeCode.DateTime: - case TypeCode.DBNull: - case TypeCode.Empty: - return XPathResultType.Error; - default: - return XPathResultType.Number; - } - } - - /// <summary> - /// This is a workaround for some problem, see - /// http://www.tkachenko.com/blog/archives/000042.html for more - /// details. - /// </summary> - /// <param name="prefix">Prefix to be resolved</param> - /// <returns>Resolved namespace</returns> - public override string LookupNamespace(string prefix) - { - if (prefix == String.Empty) - return prefix; - string uri = base.LookupNamespace(NameTable.Get(prefix)); - if (uri == null) - throw new XsltException("Undeclared namespace prefix - " + prefix, null); + if (!mismatch) + //Create lightweight wrapper around method info + return new ExsltContextFunction(mi, argTypes, obj); + } + } + } + throw new XPathException("Extension function not found: " + name, null); + } - return uri; - } - } + /// <summary> + /// Converts CLI type to XPathResultType type. + /// </summary> + /// <param name="type"></param> + /// <returns></returns> + public static XPathResultType ConvertToXPathType(Type type) + { + switch (Type.GetTypeCode(type)) + { + case TypeCode.Boolean: + return XPathResultType.Boolean; + case TypeCode.String: + return XPathResultType.String; + case TypeCode.Object: + if (typeof(IXPathNavigable).IsAssignableFrom(type) || + typeof(XPathNavigator).IsAssignableFrom(type)) + return XPathResultType.Navigator; + else if (typeof(XPathNodeIterator).IsAssignableFrom(type)) + return XPathResultType.NodeSet; + else + return XPathResultType.Any; + case TypeCode.DateTime: + case TypeCode.DBNull: + case TypeCode.Empty: + return XPathResultType.Error; + default: + return XPathResultType.Number; + } + } + + //TODO: test it + + ///// <summary> + ///// This is a workaround for some problem, see + ///// http://www.tkachenko.com/blog/archives/000042.html for more + ///// details. + ///// </summary> + ///// <param name="prefix">Prefix to be resolved</param> + ///// <returns>Resolved namespace</returns> + //public override string LookupNamespace(string prefix) + //{ + // if (prefix == String.Empty) + // return prefix; + // string uri = base.LookupNamespace(NameTable.Get(prefix)); + // if (uri == null) + // throw new XsltException("Undeclared namespace prefix - " + prefix, null); + + // return uri; + //} + } } // namespace GotDotNet.Exslt \ No newline at end of file Index: ExsltSets.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v2/src/Exslt/ExsltSets.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ExsltSets.cs 16 Oct 2005 20:07:08 -0000 1.1 +++ ExsltSets.cs 17 Oct 2005 11:03:49 -0000 1.2 @@ -26,7 +26,7 @@ /// <returns>The those nodes that are in the node set /// passed as the first argument that are not in the node set /// passed as the second argument.</returns> - public XPathNodeIterator difference(XPathNodeIterator nodeset1, XPathNodeIterator nodeset2) + public XPathNavigator[] difference(XPathNodeIterator nodeset1, XPathNodeIterator nodeset2) { if(nodeset2.Count > 166) return difference2(nodeset1, nodeset2); @@ -47,7 +47,7 @@ } } - return nodelist1; + return nodelist1.ToArray(); } /// <summary> /// Implements an optimized algorithm for the following function Index: ExsltNodeList.cs =================================================================== RCS file: /cvsroot/mvp-xml/EXSLT/v2/src/Exslt/ExsltNodeList.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ExsltNodeList.cs 16 Oct 2005 20:07:08 -0000 1.1 +++ ExsltNodeList.cs 17 Oct 2005 11:03:49 -0000 1.2 @@ -8,189 +8,208 @@ namespace Mvp.Xml.Exslt { - /// <summary> - /// A list that holds XPathNavigator objects - /// </summary> - internal class ExsltNodeList - { + /// <summary> + /// A list that holds XPathNavigator objects + /// </summary> + internal class ExsltNodeList + { - #region Private Fields and Properties + #region Private Fields and Properties - /// <summary> - /// The inner arraylist used by this class. - /// </summary> - internal IList<XPathNavigator> innerList = new List<XPathNavigator>(); + /// <summary> + /// The inner arraylist used by this class. + /// </summary> + private List<XPathNavigator> innerList = new List<XPathNavigator>(); - #endregion + #endregion - - #region Public Fields and Properties - - /// <summary> - /// Gets or sets the element at the specified index - /// </summary> - public XPathNavigator this[int index] { - get {return (XPathNavigator) this.innerList[index];} - set { this.innerList[index] = value; } - } - /// <summary> - /// Gets the number of items in the list - /// </summary> - public int Count {get { return this.innerList.Count;}} + #region Public Fields and Properties - #endregion - + /// <summary> + /// Gets or sets the element at the specified index + /// </summary> + public XPathNavigator this[int index] + { + get { return innerList[index]; } + set { innerList[index] = value; } + } - #region Constructors - - public ExsltNodeList(){} + /// <summary> + /// Gets the number of items in the list + /// </summary> + public int Count { get { return innerList.Count; } } + #endregion - /// <summary> - /// Initializes the ExsltNodeList with the specified XPathNodeIterator. All nodes - /// in the iterator are placed in the list. - /// </summary> - /// <param name="iterator">The iterator to load the nodelist from</param> - public ExsltNodeList(XPathNodeIterator iterator): this(iterator, false) {} + #region Constructors - - /// <summary> - /// Initializes the ExsltNodeList with the specified XPathNodeIterator. All nodes - /// in the iterator are placed in the list. - /// </summary> - /// <param name="iterator">The iterator to load the nodelist from</param> - /// <param name="removeDuplicates">A flag that indicates whether duplicate nodes - /// should be loaded into the nodelist or only node with unique identity should - /// be added</param> - public ExsltNodeList(XPathNodeIterator iterator, bool removeDuplicates){ - - XPathNodeIterator it = iterator.Clone(); + public ExsltNodeList() { } - while(it.MoveNext()){ - - if(removeDuplicates){ - if(this.Contains(it.Current)){ - continue; - } - } - - this.Add(it.Current.Clone()); - } - } + /// <summary> + /// Initializes the ExsltNodeList with the specified XPathNodeIterator. All nodes + /// in the iterator are placed in the list. + /// </summary> + /// <param name="iterator">The iterator to load the nodelist from</param> + public ExsltNodeList(XPathNodeIterator iterator) : this(iterator, false) { } - #endregion - #region Public Methods + /// <summary> + /// Initializes the ExsltNodeList with the specified XPathNodeIterator. All nodes + /// in the iterator are placed in the list. + /// </summary> + /// <param name="iterator">The iterator to load the nodelist from</param> + /// <param name="removeDuplicates">A flag that indicates whether duplicate nodes + /// should be loaded into the nodelist or only node with unique identity should + /// be added</param> + public ExsltNodeList(XPathNodeIterator iterator, bool removeDuplicates) + { + XPathNodeIterator it = iterator.Clone(); - /// <summary> - /// Returns an enumerator for the entire list. - /// </summary> - /// <returns>An enumerator for the entire list</returns> - public IEnumerator<XPathNavigator> GetEnumerator(){ - return this.innerList.GetEnumerator(); - } + while (it.MoveNext()) + { - /// <summary> - /// Adds an item to the list - /// </summary> - /// <param name="value">The item to add</param> - public void Add( XPathNavigator nav){ + if (removeDuplicates) + { + if (Contains(it.Current)) + { + continue; + } + } - this.innerList.Add(nav); - } + Add(it.Current.Clone()); + } + } - /// <summary> - /// Removes all items from the list. - /// </summary> - public void Clear(){ - this.innerList.Clear(); - } + #endregion - /// <summary> - /// Determines whether the list contains a navigator positioned at the same - /// location as the specified XPathNavigator. This - /// method relies on the IsSamePositon() method of the XPathNavightor. - /// </summary> - /// <param name="value">The object to locate in the list.</param> - /// <returns>true if the object is found in the list; otherwise, false.</returns> - public bool Contains(XPathNavigator value){ - - foreach(XPathNavigator nav in this.innerList){ - if(nav.IsSamePosition(value)){ - return true; - } - } - return false; - } - /// <summary> - /// Determines whether the list contains a navigator whose Value property matches - /// the target value - /// </summary> - /// <param name="value">The value to locate in the list.</param> - /// <returns>true if the value is found in the list; otherwise, false.</returns> - public bool ContainsValue(string value){ - - foreach(XPathNavigator nav in this.innerList){ - if(nav.Value.Equals(value)){ - return true; - } - } - return false; - } + #region Public Methods - /// <summary> - /// Determines the index of a specific item in the list. - /// </summary> - /// <param name="value">The object to locate in the list</param> - /// <returns>The index of value if found in the list; otherwise, -1.</returns> - public int IndexOf( object value ){ - - return this.innerList.IndexOf(value as XPathNavigator); - } - /// <summary> - /// Inserts an item to the list at the specified position. - /// </summary> - /// <param name="index">The zero-based index at which value should be inserted. </param> - /// <param name="value">The object to insert into the list</param> - public void Insert(int index,XPathNavigator nav ){ + /// <summary> + /// Returns an enumerator for the entire list. + /// </summary> + /// <returns>An enumerator for the entire list</returns> + public IEnumerator<XPathNavigator> GetEnumerator() + { + return innerList.GetEnumerator(); + } - this.innerList.Insert(index, nav); - } + /// <summary> + /// Adds an item to the list + /// </summary> + /// <param name="value">The item to add</param> + public void Add(XPathNavigator nav) + { + innerList.Add(nav); + } - /// <summary> - /// Removes the first occurrence of a specific object from the list. - /// </summary> - /// <param name="value">The object to remove from the list.</param> - public void Remove(XPathNavigator nav){ - - for(int i = 0; i < this.Count; i++){ - if(nav.IsSamePosition((XPathNavigator) this.innerList[i])){ - this.innerList.RemoveAt(i); - return; - } - } - } - /// <summary> - /// Removes the list item at the specified index. - /// </summary> - /// <param name="index">The zero-based index of the item to remove.</param> - public void RemoveAt(int index){ - - this.innerList.RemoveAt(index); - } + /// <summary> + /// Removes all items from the list. + /// </summary> + public void Clear() + { + innerList.Clear(); + } + /// <summary> + /// Determines whether the list contains a navigator positioned at the same + /// location as the specified XPathNavigator. This + /// method relies on the IsSamePositon() method of the XPathNavightor. + /// </summary> + /// <param name="value">The object to locate in the list.</param> + /// <returns>true if the object is found in the list; otherwise, false.</returns> + public bool Contains(XPathNavigator value) + { - #endregion + foreach (XPathNavigator nav in innerList) + { + if (nav.IsSamePosition(value)) + { + return true; + } + } + return false; + } - } + /// <summary> + /// Determines whether the list contains a navigator whose Value property matches + /// the target value + /// </summary> + /// <param name="value">The value to locate in the list.</param> + /// <returns>true if the value is found in the list; otherwise, false.</returns> + public bool ContainsValue(string value) + { + + foreach (XPathNavigator nav in innerList) + { + if (nav.Value.Equals(value)) + { + return true; + } + } + return false; + } + + /// <summary> + /// Determines the index of a specific item in the list. + /// </summary> + /// <param name="value">The object to locate in the list</param> + /// <returns>The index of value if found in the list; otherwise, -1.</returns> + public int IndexOf(object value) + { + + return innerList.IndexOf(value as XPathNavigator); + } + + /// <summary> + /// Inserts an item to the list at the specified position. + /// </summary> + /// <param name="index">The zero-based index at which value should be inserted. </param> + /// <param name="value">The object to insert into the list</param> + public void Insert(int index, XPathNavigator nav) + { + + innerList.Insert(index, nav); + } + + + /// <summary> + /// Removes the first occurrence of a specific object from the list. + /// </summary> + /// <param name="value">The object to remove from the list.</param> + public void Remove(XPathNavigator nav) + { + + for (int i = 0; i < Count; i++) + { + if (nav.IsSamePosition(innerList[i])) + { + innerList.RemoveAt(i); + return; + } + } + } + + /// <summary> + /// Removes the list item at the specified index. + /// </summary> + /// <param name="index">The zero-based index of the item to remove.</param> + public void RemoveAt(int index) + { + + innerList.RemoveAt(index); + } + + #endregion + + } } |
From: Oleg T. <he...@us...> - 2005-10-16 20:28:24
|
Update of /cvsroot/mvp-xml/EXSLT/v2/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17169/v2/lib Added Files: changelog.txt Log Message: --- NEW FILE: changelog.txt --- --------------------------------------------------------- July 19, 2005 Initial setup. Will contain external libraries referenced by the project. |
From: Oleg T. <he...@us...> - 2005-10-16 20:28:24
|
Update of /cvsroot/mvp-xml/EXSLT/v2/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17169/v2/doc Added Files: changelog.txt Log Message: --- NEW FILE: changelog.txt --- --------------------------------------------------------- July 19, 2005 Initial setup. Will contain external libraries referenced by the project. |
From: Oleg T. <he...@us...> - 2005-10-16 20:27:49
|
Update of /cvsroot/mvp-xml/EXSLT/v2/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17058/lib Log Message: Directory /cvsroot/mvp-xml/EXSLT/v2/lib added to the repository |
From: Oleg T. <he...@us...> - 2005-10-16 20:27:24
|
Update of /cvsroot/mvp-xml/EXSLT/v2/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16955/doc Log Message: Directory /cvsroot/mvp-xml/EXSLT/v2/doc added to the repository |
From: Oleg T. <he...@us...> - 2005-10-16 20:13:32
|
Update of /cvsroot/mvp-xml/EXSLT/v2/test/ExsltTest/tests/EXSLT/Strings In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14178/v2/test/ExsltTest/tests/EXSLT/Strings Added Files: align.xslt concat.xslt decode-uri.xslt encode-uri.xslt padding.xslt replace.xslt source.xml split.xslt tmp0000.xml tokenize.xslt Log Message: --- NEW FILE: split.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" exclude-result-prefixes="str"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:copy-of select="str:split('a, simple, list', ', ')"/> </test1> <test2> <xsl:copy-of select="str:split('date math str')"/> </test2> <test3> <xsl:copy-of select="str:split('foo', '')"/> </test3> <test4> <xsl:copy-of select="str:split('cats and dogs', ' and ')"/> </test4> <test5> <xsl:copy-of select="str:split('', ' and ')"/> </test5> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: tmp0000.xml --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> <?xml-stylesheet type="text/xsl" href="D:\docbook\docbook-xsl-1.66.0\fo\docbook.xsl"?> <article> <title>Article Title</title> <sect1> <title>Section1 Title</title> <para>Text</para> </sect1> </article> --- NEW FILE: decode-uri.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" exclude-result-prefixes="str"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="str:decode-uri('http://www.example.com/my%20r%C3%A9sum%C3%A9.html')"/> </test1> <test2> <xsl:value-of select="str:decode-uri('http://www.example.com/my%20r%E9sum%E9.html','iso-8859-1')"/> </test2> <test3> <xsl:value-of select="str:decode-uri('http://www.example.com/my%20r%E9sum%E9.html','not-supported-enc')"/> </test3> <test4> <xsl:value-of select="str:decode-uri('http://www.example.com/my%20r%E9sum%E9.html','')"/> </test4> <test4> <xsl:value-of select="str:decode-uri(url, '')"/> </test4> <test5> <xsl:value-of select="str:decode-uri(uri)"/> </test5> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: tokenize.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" exclude-result-prefixes="str"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="/"> <out> <test1> <xsl:copy-of select="str:tokenize('2001-06-03T11:40:23', '-T:')"/> </test1> <test2> <xsl:copy-of select="str:tokenize('date math str')"/> </test2> <test3> <xsl:copy-of select="str:tokenize('foo', '')"/> </test3> <test4> <xsl:copy-of select="str:tokenize('', '-')"/> </test4> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: padding.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" exclude-result-prefixes="str"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="str:padding(20, '_')"/> </test1> <test2> <xsl:value-of select="str:padding(5, 'abc')"/> </test2> <test3> <xsl:value-of select="str:padding(10, '')"/> </test3> <test4> <xsl:value-of select="str:padding(12)"/> </test4> <test5> <xsl:value-of select="str:padding(0, 'foo')"/> </test5> <test6> <xsl:value-of select="str:padding(-2, 'foo')"/> </test6> <test7> <xsl:value-of select="str:padding(-4)"/> </test7> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: replace.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" exclude-result-prefixes="str"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:copy-of select="str:replace('foo bar', 'bar', 'baz')"/> </test1> <test2> <xsl:copy-of select="str:replace('foo bar', 'no', 'baz')"/> </test2> <test3> <xsl:value-of select="str:replace(email, '@', '@NOSPAM')"/> </test3> <test4> <xsl:value-of select="str:replace('', 'foo', 'bar')"/> </test4> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: source.xml --- <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="split.xslt"?> <data> <email>jo...@do...</email> <name>Danny</name> <uri>http://www.example.com/my résumé.html</uri> <list> <a>abcd</a> <b>efgh</b> <c></c> <d>kl<e>ml</e></d> </list> </data> --- NEW FILE: align.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" exclude-result-prefixes="str"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="str:align(name, str:padding(20, '_'), 'left')"/> </test1> <test2> <xsl:value-of select="str:align(name, str:padding(20, '_'), 'center')"/> </test2> <test3> <xsl:value-of select="str:align(name, str:padding(20, '_'), 'right')"/> </test3> <test4> <xsl:value-of select="str:align(name, str:padding(20, '_'))"/> </test4> <test5> <xsl:value-of select="str:align(name, str:padding(20, '_'), 'none')"/> </test5> <test6> <xsl:value-of select="str:align(name, str:padding(2, '*'), 'center')"/> </test6> <test7> <xsl:value-of select="str:align('', '*******', 'center')"/> </test7> <test8> <xsl:value-of select="str:align('foo', '')"/> </test8> <test9> <xsl:value-of select="str:align('foo', '******', '')"/> </test9> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: concat.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" exclude-result-prefixes="str"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="str:concat(list/*)"/> </test1> <test2> <xsl:value-of select="str:concat(/no/such/nodes)"/> </test2> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: encode-uri.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" exclude-result-prefixes="str"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="str:encode-uri('http://www.example.com/my résumé.html',false())"/> </test1> <test2> <xsl:value-of select="str:encode-uri('http://www.example.com/my résumé.html',true())"/> </test2> <test3> <xsl:value-of select="str:encode-uri('http://www.example.com/my résumé.html',false(),'iso-8859-1')"/> </test3> <test4> <xsl:value-of select="str:encode-uri('http://www.example.com/my résumé.html',false(),'not-supported-enc')"/> </test4> <test5> <xsl:value-of select="str:encode-uri('http://www.example.com/my résumé.html%24',false())"/> </test5> <test6> <xsl:value-of select="str:encode-uri('http://www.example.com/my résumé.html%2sss',false())"/> </test6> <test7> <xsl:value-of select="str:encode-uri('http://www.ex%ample.com/my résumé.html',false())"/> </test7> <test8> <xsl:value-of select="str:encode-uri('http://www.example.com/my résumé.html',false(),'')"/> </test8> <test9> <xsl:value-of select="str:encode-uri('http://www.example.com/my résumé.html',true(),'')"/> </test9> <test9> <xsl:value-of select="str:encode-uri(uri ,true(),'')"/> </test9> </out> </xsl:template> </xsl:stylesheet> |
From: Oleg T. <he...@us...> - 2005-10-16 20:13:25
|
Update of /cvsroot/mvp-xml/EXSLT/v2/test/ExsltTest/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14178/v2/test/ExsltTest/tests Added Files: availability.xslt invoice-processor.xsl invoice.xml regexp-match-test.xslt test.xml Log Message: --- NEW FILE: invoice-processor.xsl --- <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" exclude-result-prefixes="exsl"> <xsl:template match="/"> <!-- Main result document - confirmation --> <html> <head> <title>Thank you for purchasing!</title> </head> <body> <h2>Thank you for purchasing at fabrikam.com!</h2> </body> <xsl:apply-templates mode="order"/> </html> </xsl:template> <xsl:template match="invoice" mode="order"> <!-- Additional result document - SOAP message for fabrikam.com order processing web service --> <exsl:document href="soap/order.xml" indent="yes"> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns:Order xmlns:ns="urn:fabrikam-com:orders"> <xsl:apply-templates mode="order"/> </ns:Order> </soap:Body> </soap:Envelope> </exsl:document> </xsl:template> <xsl:template match="item" mode="order"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet> --- NEW FILE: test.xml --- <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="D:\projects\EXSLT.NET\ExsltTest\tests\availability.xslt"?> <root> </root> --- NEW FILE: availability.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:date="http://exslt.org/dates-and-times" xmlns:math="http://exslt.org/math" xmlns:random="http://exslt.org/random" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:set="http://exslt.org/sets" xmlns:str="http://exslt.org/strings" xmlns:date2="http://gotdotnet.com/exslt/dates-and-times" xmlns:math2="http://gotdotnet.com/exslt/math" xmlns:regexp2="http://gotdotnet.com/exslt/regular-expressions" xmlns:set2="http://gotdotnet.com/exslt/sets" xmlns:str2="http://gotdotnet.com/exslt/strings" xmlns:dyn2="http://gotdotnet.com/exslt/dynamic" exclude-result-prefixes="exsl date math regexp set str date2 math2 regexp2 set2 random dyn2"> <xsl:template match="/"> <html> <head> <title>EXSLT.NET regression test - functions availability</title> </head> <body> <h3>EXSLT.NET regression test - functions availability</h3> <xsl:apply-templates select="document('../../../doc/Functions.xml')/*/module"/> </body> </html> </xsl:template> <xsl:template match="module"> <p> <h4><xsl:if test="@is-exslt-module='yes'">EXSLT: </xsl:if> <xsl:value-of select="@name"/></h4> <table border="1" width="100%"> <tr> <th>Function name</th> <th>Availability</th> </tr> <xsl:apply-templates select="function"/> </table> </p> </xsl:template> <xsl:template match="function"> <tr> <xsl:variable name="fn" select="concat(../@prefix, ':', @name)"/> <td><xsl:value-of select="$fn"/></td> <td align="center"> <xsl:choose> <xsl:when test="function-available($fn)"> <span style="color:green">Ok</span> </xsl:when> <xsl:otherwise> <span style="color:red">Not available</span> </xsl:otherwise> </xsl:choose> </td> </tr> </xsl:template> </xsl:stylesheet> --- NEW FILE: regexp-match-test.xslt --- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:regexp="http://exslt.org/regular-expressions"> <xsl:template match="/"> -------------------------------------------------------------------- Test 1, expected results: Part 1 = http://www.bayes.co.uk/xml/index.xml?/xml/utils/rechecker.xml Part 2 = http Part 3 = www.bayes.co.uk Part 4 = Part 5 = /xml/index.xml?/xml/utils/rechecker.xml Results: <xsl:for-each select="regexp:match('http://www.bayes.co.uk/xml/index.xml?/xml/utils/rechecker.xml', '(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)')"> Part <xsl:value-of select="position()" /> = <xsl:value-of select="." /> </xsl:for-each> -------------------------------------------------------------------- Test 2, expected results: Part 1 = This Part 2 = is Part 3 = a Part 4 = test Part 5 = string Results: <xsl:for-each select="regexp:match('This is a test string', '(\w+)', 'g')"> Part <xsl:value-of select="position()" /> = <xsl:value-of select="." /> </xsl:for-each> -------------------------------------------------------------------- Test 3, expected results: Part 1 = his Part 2 = is Part 3 = a Part 4 = test Results: <xsl:for-each select="regexp:match('This is a test string', '([a-z])+ ', 'g')"> Part <xsl:value-of select="position()" /> = <xsl:value-of select="." /> </xsl:for-each> -------------------------------------------------------------------- Test 4, expected results: Part 1 = This Part 2 = is Part 3 = a Part 4 = test Results: <xsl:for-each select="regexp:match('This is a test string', '([a-z])+ ', 'gi')"> Part <xsl:value-of select="position()" /> = <xsl:value-of select="." /> </xsl:for-each> -------------------------------------------------------------------- Test 5, expected results: Part 1 = 22/12/2003 21:00 AcmeService DB updated Part 2 = 22/12/2003 Part 3 = 21:00 Part 4 = AcmeService Part 5 = DB updated Results: <xsl:for-each select="regexp:match ('22/12/2003 21:00 AcmeService DB updated', '(\d{1,2}/\d{1,2}/\d{4})\s+(\d{2}:\d{2})\s+(\w*)\s+(.*)')"> Part <xsl:value-of select="position()" /> = <xsl:value-of select="." /> </xsl:for-each> </xsl:template> </xsl:stylesheet> --- NEW FILE: invoice.xml --- <invoice> <item>Wallabee</item> <item>Wombat</item> <item>Wren</item> </invoice> |
Update of /cvsroot/mvp-xml/EXSLT/v2/test/ExsltTest/results/EXSLT/Strings In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14178/v2/test/ExsltTest/results/EXSLT/Strings Added Files: align.xml concat.xml decode-uri.xml encode-uri.xml padding.xml replace.xml split.xml tokenize.xml Log Message: --- NEW FILE: decode-uri.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: split.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: tokenize.xml --- <out> <test1> <token>2001</token> <token>06</token> <token>03</token> <token>11</token> <token>40</token> <token>23</token> </test1> <test2> <token>date</token> <token>math</token> <token>str</token> </test2> <test3> <token>f</token> <token>o</token> <token>o</token> </test3> <test4> <token></token> </test4> </out> --- NEW FILE: replace.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: padding.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: encode-uri.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: align.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: concat.xml --- (This appears to be a binary file; contents omitted.) |
From: Oleg T. <he...@us...> - 2005-10-16 20:13:25
|
Update of /cvsroot/mvp-xml/EXSLT/v2/test/ExsltTest/tests/GotDotNet/Sets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14178/v2/test/ExsltTest/tests/GotDotNet/Sets Added Files: source.xml subset.xslt Log Message: --- NEW FILE: source.xml --- <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="subset.xslt"?> <data> <doc> <city name="Paris" country="France"/> <city name="Madrid" country="Spain"/> <city name="Vienna" country="Austria"/> <city name="Barcelona" country="Spain"/> <city name="Salzburg" country="Austria"/> <city name="Bonn" country="Germany"/> <city name="Lyon" country="France"/> <city name="Hannover" country="Germany"/> <city name="Calais" country="France"/> <city name="Berlin" country="Germany"/> </doc> </data> --- NEW FILE: subset.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:set2="http://gotdotnet.com/exslt/sets" exclude-result-prefixes="set2"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:variable name="all-cities" select="doc/city"/> <xsl:variable name="all-spanish-cities" select="doc/city[@country='Spain']"/> Set of Spanish cities is a subset of all cities, right? <xsl:value-of select="set2:subset($all-spanish-cities, $all-cities)"/> Set of all cities is a subset of Spanish cities, right? <xsl:value-of select="set2:subset($all-cities, $all-spanish-cities)"/> </test1> <test2> <xsl:value-of select="set2:subset(doc/city, /no/such/node)"/> </test2> <test3> <xsl:value-of select="set2:subset(/no/such/node, doc/city)"/> </test3> <test4> <xsl:value-of select="set2:subset(/no/such/node, /no/such/node)"/> </test4> </out> </xsl:template> </xsl:stylesheet> |
From: Oleg T. <he...@us...> - 2005-10-16 20:13:25
|
Update of /cvsroot/mvp-xml/EXSLT/v2/test/ExsltTest/tests/GotDotNet/RegularExpressions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14178/v2/test/ExsltTest/tests/GotDotNet/RegularExpressions Added Files: source.xml tokenize.xslt Log Message: --- NEW FILE: source.xml --- <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="tokenize.xslt"?> <data> <input>The quick brown fox jumps over a lazy dog.</input> </data> --- NEW FILE: tokenize.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:regexp2="http://gotdotnet.com/exslt/regular-expressions" exclude-result-prefixes="regexp2"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:copy-of select="regexp2:tokenize(input, ' ')"/> </test1> <test2> <xsl:copy-of select="regexp2:tokenize(input, ' ', 'm')"/> </test2> <test3> <xsl:copy-of select="regexp2:tokenize(input, ' ', 'i')"/> </test3> <test4> <xsl:copy-of select="regexp2:tokenize(input, ' ', 'mi')"/> </test4> <test5> <xsl:copy-of select="regexp2:tokenize(input, ' ', '')"/> </test5> <test6> <xsl:copy-of select="regexp2:tokenize(/no/such/node, ' ')"/> </test6> <test7> <xsl:copy-of select="regexp2:tokenize(input, '')"/> </test7> </out> </xsl:template> </xsl:stylesheet> |
From: Oleg T. <he...@us...> - 2005-10-16 20:13:25
|
Update of /cvsroot/mvp-xml/EXSLT/v2/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14178/v2/test Added Files: changelog.txt Log Message: --- NEW FILE: changelog.txt --- --------------------------------------------------------- October 15, 2005 Initial setup. Will contain tests for the project. |
From: Oleg T. <he...@us...> - 2005-10-16 20:13:23
|
Update of /cvsroot/mvp-xml/EXSLT/v2/test/ExsltXPathTest/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14178/v2/test/ExsltXPathTest/tests Added Files: books.xml foo.xml Log Message: --- NEW FILE: foo.xml --- <root> <section id="dfn3"></section> </root> --- NEW FILE: books.xml --- <?xml version="1.0" encoding="UTF-8"?> <catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="books.xsd"> <book id="bk101"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>An in-depth look at creating applications with XML.</description> </book> <book id="bk102"> <author>Ralls, Kim</author> <title>Midnight Rain</title> <genre>Fantasy</genre> <price>5.95</price> <publish_date>2000-12-16</publish_date> <description>A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.</description> </book> <book id="bk103"> <author>Corets, Eva</author> <title>Maeve Ascendant</title> <genre>Fantasy</genre> <price>5.95</price> <publish_date>2000-11-17</publish_date> <description>After the collapse of a nanotechnology society in England, the young survivors lay the foundation for a new society.</description> </book> <book id="bk104"> <author>Corets, Eva</author> <title>Oberon's Legacy</title> <genre>Fantasy</genre> <price>5.95</price> <publish_date>2001-03-10</publish_date> <description>In post-apocalypse England, the mysterious agent known only as Oberon helps to create a new life for the inhabitants of London. Sequel to Maeve Ascendant.</description> </book> <book id="bk105"> <author>Corets, Eva</author> <title>The Sundered Grail</title> <genre>Fantasy</genre> <price>5.95</price> <publish_date>2001-09-10</publish_date> <description>The two daughters of Maeve, half-sisters, battle one another for control of England. Sequel to Oberon's Legacy.</description> </book> <book id="bk106"> <author>Randall, Cynthia</author> <title>Lover Birds</title> <genre>Romance</genre> <price>4.95</price> <publish_date>2000-09-02</publish_date> <description>When Carla meets Paul at an ornithology conference, tempers fly as feathers get ruffled.</description> </book> <book id="bk107"> <author>Thurman, Paula</author> <title>Splish Splash</title> <genre>Romance</genre> <price>4.95</price> <publish_date>2000-11-02</publish_date> <description>A deep sea diver finds true love twenty thousand leagues beneath the sea.</description> </book> <book id="bk108"> <author>Knorr, Stefan</author> <title>Creepy Crawlies</title> <genre>Horror</genre> <price>4.95</price> <publish_date>2000-12-06</publish_date> <description>An anthology of horror stories about roaches, centipedes, scorpions and other insects.</description> </book> <book id="bk109"> <author>Kress, Peter</author> <title>Paradox Lost</title> <genre>Science Fiction</genre> <price>6.95</price> <publish_date>2000-11-02</publish_date> <description>After an inadvertant trip through a Heisenberg Uncertainty Device, James Salway discovers the problems of being quantum.</description> </book> <book id="bk110"> <author>O'Brien, Tim</author> <title>Microsoft .NET: The Programming Bible</title> <genre>Computer</genre> <price>36.95</price> <publish_date>2000-12-09</publish_date> <description>Microsoft's .NET initiative is explored in detail in this deep programmer's reference.</description> </book> <book id="bk111"> <author>O'Brien, Tim</author> <title>MSXML3: A Comprehensive Guide</title> <genre>Computer</genre> <price>36.95</price> <publish_date>2000-12-01</publish_date> <description>The Microsoft MSXML3 parser is covered in detail, with attention to XML DOM interfaces, XSLT processing, SAX and more.</description> </book> <book id="bk112"> <author>Galos, Mike</author> <title>Visual Studio 7: A Comprehensive Guide</title> <genre>Computer</genre> <price>49.95</price> <publish_date>2001-04-16</publish_date> <description>Microsoft Visual Studio 7 is explored in depth, looking at how Visual Basic, Visual C++, C#, and ASP+ are integrated into a comprehensive development environment.</description> </book> </catalog> |
Update of /cvsroot/mvp-xml/EXSLT/v2/test/ExsltTest/tests/EXSLT/DatesAndTimes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14178/v2/test/ExsltTest/tests/EXSLT/DatesAndTimes Added Files: add-duration.xslt add.xslt date-time.xslt date.xslt day-abbreviation.xslt day-in-month.xslt day-in-week.xslt day-in-year.xslt day-name.xslt day-of-week-in-month.xslt difference.xslt duration.xslt format-date.xslt hour-in-day.xslt leap-year.xslt minute-in-hour.xslt month-abbreviation.xslt month-in-year.xslt month-name.xslt parse-date.xslt second-in-minute.xslt seconds.xslt source.xml sum.xslt time.xslt week-in-month.xslt week-in-year.xslt year.xslt Log Message: --- NEW FILE: month-name.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:month-name(date)"/> </test1> <test2> <xsl:value-of select="date:month-name(bad-date)"/> </test2> <test3> <xsl:value-of select="date:month-name('2004-01-19T07:59:02')"/> </test3> <test4> <xsl:value-of select="date:month-name('2004-02-19T07:59:02')"/> </test4> <test5> <xsl:value-of select="date:month-name('2004-03-19T07:59:02')"/> </test5> <test6> <xsl:value-of select="date:month-name('2004-04-19T07:59:02')"/> </test6> <test7> <xsl:value-of select="date:month-name('2004-05-19T07:59:02')"/> </test7> <test8> <xsl:value-of select="date:month-name('2004-06-19T07:59:02')"/> </test8> <test9> <xsl:value-of select="date:month-name('2004-07-19T07:59:02')"/> </test9> <test10> <xsl:value-of select="date:month-name('2004-08-19T07:59:02')"/> </test10> <test11> <xsl:value-of select="date:month-name('2004-09-19T07:59:02')"/> </test11> <test12> <xsl:value-of select="date:month-name('2004-10-19T07:59:02')"/> </test12> <test13> <xsl:value-of select="date:month-name('2004-11-19T07:59:02')"/> </test13> <test14> <xsl:value-of select="date:month-name('2004-12-19T07:59:02')"/> </test14> <test15> <xsl:value-of select="date:month-name('2004-13-19T07:59:02')"/> </test15> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: duration.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:duration(994241336)"/> </test1> <test2> <xsl:value-of select="date:duration(1000274342)"/> </test2> <test3> <xsl:value-of select="date:duration(10368000)"/> </test3> <test4> <xsl:value-of select="date:duration(63072000)"/> </test4> <test5> <xsl:value-of select="date:duration(7776000)"/> </test5> <test6> <xsl:value-of select="date:duration(-7776000)"/> </test6> <test7> <xsl:value-of select="date:duration(11 div 0)"/> </test7> <test8> <xsl:value-of select="date:duration(0)"/> </test8> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: hour-in-day.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:hour-in-day(date)"/> </test1> <test2> <xsl:value-of select="date:hour-in-day(bad-date)"/> </test2> <test3> <xsl:value-of select="date:hour-in-day(time)"/> </test3> <test4> <xsl:value-of select="date:hour-in-day(date3)"/> </test4> <test5> <xsl:value-of select="date:hour-in-day(time2)"/> </test5> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: add-duration.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:add-duration('P1YT2S', 'P2D')"/> </test1> <test2> <xsl:value-of select="date:add-duration('P3M2D', 'PT5H2M')"/> </test2> <test3> <xsl:value-of select="date:add-duration('ZZZ', 'P2Y')"/> </test3> <test4> <xsl:value-of select="date:add-duration('', 'P2Y')"/> </test4> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: week-in-year.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:week-in-year(date)"/> </test1> <test1> <xsl:value-of select="date:week-in-year(bad-date)"/> </test1> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: source.xml --- <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="parse-date.xslt"?> <data> <date>2001-07-04T12:08:56+02:00</date> <date2>2001-09-12T07:59:02+02:00</date2> <date3>2001-09-12T07:59:02</date3> <time>07:59:02+02:00</time> <time2>07:59:02</time2> <bad-date>2001/07/04</bad-date> <d>P1YT2S</d> <d>P2D</d> <d>P3M2D</d> <d>PT5H2M</d> <bad-d>PM3D</bad-d> <dates> <test1>2001.07.04 AD 12:08:56 +02:00</test1> <test2>Wed, Jul 4, 2001</test2> <test3>12:08 PM</test3> <test4>12 PM, +02:00</test4> <test5>0:08 PM, +02:00</test5> <test6>02001.July.04 AD 12:08 PM</test6> <test7>Wed, 4 Jul 2001 12:08:56 +0200</test7> <test8>010704120856+0200</test8> <test9/> <test10/> </dates> </data> --- NEW FILE: month-abbreviation.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:month-abbreviation(date)"/> </test1> <test2> <xsl:value-of select="date:month-abbreviation(bad-date)"/> </test2> <test3> <xsl:value-of select="date:month-abbreviation('2004-01-19T07:59:02')"/> </test3> <test4> <xsl:value-of select="date:month-abbreviation('2004-02-19T07:59:02')"/> </test4> <test5> <xsl:value-of select="date:month-abbreviation('2004-03-19T07:59:02')"/> </test5> <test6> <xsl:value-of select="date:month-abbreviation('2004-04-19T07:59:02')"/> </test6> <test7> <xsl:value-of select="date:month-abbreviation('2004-05-19T07:59:02')"/> </test7> <test8> <xsl:value-of select="date:month-abbreviation('2004-06-19T07:59:02')"/> </test8> <test9> <xsl:value-of select="date:month-abbreviation('2004-07-19T07:59:02')"/> </test9> <test10> <xsl:value-of select="date:month-abbreviation('2004-08-19T07:59:02')"/> </test10> <test11> <xsl:value-of select="date:month-abbreviation('2004-09-19T07:59:02')"/> </test11> <test12> <xsl:value-of select="date:month-abbreviation('2004-10-19T07:59:02')"/> </test12> <test13> <xsl:value-of select="date:month-abbreviation('2004-11-19T07:59:02')"/> </test13> <test14> <xsl:value-of select="date:month-abbreviation('2004-12-19T07:59:02')"/> </test14> <test15> <xsl:value-of select="date:month-abbreviation('2004-13-19T07:59:02')"/> </test15> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: minute-in-hour.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:minute-in-hour(date)"/> </test1> <test2> <xsl:value-of select="date:minute-in-hour(bad-date)"/> </test2> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: add.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:add(date, 'P2D')"/> </test1> <test2> <xsl:value-of select="date:add(date2, 'PT5H2M')"/> </test2> <test3> <xsl:value-of select="date:add(bad-date, 'P2Y')"/> </test3> <test4> <xsl:value-of select="date:add(date3, 'P2DT1H1M')"/> </test4> <test5> <xsl:value-of select="date:add('2000-01-12T12:13:14Z', 'P1Y3M5DT7H10M3S')"/> </test5> <test6> <xsl:value-of select="date:add('2000-01', '-P3M')"/> </test6> <test7> <xsl:value-of select="date:add('2000-01-12', 'PT33H')"/> </test7> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: month-in-year.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:month-in-year(date)"/> </test1> <test1> <xsl:value-of select="date:month-in-year(bad-date)"/> </test1> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: sum.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:sum(d)"/> </test1> <test2> <xsl:value-of select="date:sum(d|bad-d)"/> </test2> <test3> <xsl:value-of select="date:sum(/no/such/nodes)"/> </test3> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: day-of-week-in-month.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:day-of-week-in-month(date)"/> </test1> <test2> <xsl:value-of select="date:day-of-week-in-month(bad-date)"/> </test2> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: day-abbreviation.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:day-abbreviation(date)"/> </test1> <test2> <xsl:value-of select="date:day-abbreviation(bad-date)"/> </test2> <test3> <xsl:value-of select="date:day-abbreviation('2004-09-19T07:59:02')"/> </test3> <test4> <xsl:value-of select="date:day-abbreviation('2004-09-20T07:59:02')"/> </test4> <test5> <xsl:value-of select="date:day-abbreviation('2004-09-21T07:59:02')"/> </test5> <test6> <xsl:value-of select="date:day-abbreviation('2004-09-22T07:59:02')"/> </test6> <test7> <xsl:value-of select="date:day-abbreviation('2004-09-23T07:59:02')"/> </test7> <test8> <xsl:value-of select="date:day-abbreviation('2004-09-24T07:59:02')"/> </test8> <test9> <xsl:value-of select="date:day-abbreviation('2004-09-25T07:59:02')"/> </test9> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: difference.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:difference(date, date2)"/> </test1> <test2> <xsl:value-of select="date:difference(date2, date)"/> </test2> <test3> <xsl:value-of select="date:difference(bad-date, date)"/> </test3> <test4> <xsl:value-of select="date:difference('', date)"/> </test4> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: time.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:time(date)"/> </test1> <test2> <xsl:value-of select="date:time(bad-date)"/> </test2> <test3> <xsl:value-of select="date:time(date3)"/> </test3> <test4> <xsl:value-of select="date:time(time)"/> </test4> <test5> <xsl:value-of select="date:time(time2)"/> </test5> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: date.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:date(date)"/> </test1> <test2> <xsl:value-of select="date:date(bad-date)"/> </test2> <test3> <xsl:value-of select="date:date(date3)"/> </test3> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: day-in-week.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:day-in-week(date)"/> </test1> <test2> <xsl:value-of select="date:day-in-week(bad-date)"/> </test2> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: day-in-year.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:day-in-year(date)"/> </test1> <test1> <xsl:value-of select="date:day-in-year(bad-date)"/> </test1> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: day-name.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:day-name(date)"/> </test1> <test2> <xsl:value-of select="date:day-name(bad-date)"/> </test2> <test3> <xsl:value-of select="date:day-name('2004-09-19T07:59:02')"/> </test3> <test4> <xsl:value-of select="date:day-name('2004-09-20T07:59:02')"/> </test4> <test5> <xsl:value-of select="date:day-name('2004-09-21T07:59:02')"/> </test5> <test6> <xsl:value-of select="date:day-name('2004-09-22T07:59:02')"/> </test6> <test7> <xsl:value-of select="date:day-name('2004-09-23T07:59:02')"/> </test7> <test8> <xsl:value-of select="date:day-name('2004-09-24T07:59:02')"/> </test8> <test9> <xsl:value-of select="date:day-name('2004-09-25T07:59:02')"/> </test9> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: format-date.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:format-date(date, 'yyyy.MM.dd G HH:mm:ss z')"/> </test1> <test2> <xsl:value-of select="date:format-date(date, 'EEE, MMM d, yyyy')"/> </test2> <test3> <xsl:value-of select="date:format-date(date, 'h:mm a')"/> </test3> <test4> <xsl:value-of select="date:format-date(date, 'hh a, zzzz')"/> </test4> <test5> <xsl:value-of select="date:format-date(date, 'K:mm a, z')"/> </test5> <test6> <xsl:value-of select="date:format-date(date, 'yyyyy.MMMMM.dd GGG hh:mm aaa')"/> </test6> <test7> <xsl:value-of select="date:format-date(date, 'EEE, d MMM yyyy HH:mm:ss Z')"/> </test7> <test8> <xsl:value-of select="date:format-date(date, 'yyMMddHHmmssZ')"/> </test8> <test9> <xsl:value-of select="date:format-date(/no/such/node, 'yyMMddHHmmssZ')"/> </test9> <test10> <xsl:value-of select="date:format-date(date, '')"/> </test10> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: second-in-minute.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:second-in-minute(date)"/> </test1> <test2> <xsl:value-of select="date:second-in-minute(bad-date)"/> </test2> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: seconds.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:seconds(date)"/> </test1> <test2> <xsl:value-of select="date:seconds(date2)"/> </test2> <test3> <xsl:value-of select="date:seconds('P120D')"/> </test3> <test4> <xsl:value-of select="date:seconds('P2Y')"/> </test4> <test5> <xsl:value-of select="date:seconds('P3M')"/> </test5> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: year.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:year(date)"/> </test1> <test1> <xsl:value-of select="date:year(bad-date)"/> </test1> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: week-in-month.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:week-in-month(date)"/> </test1> <test1> <xsl:value-of select="date:week-in-month(bad-date)"/> </test1> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: day-in-month.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:day-in-month(date)"/> </test1> <test1> <xsl:value-of select="date:day-in-month(bad-date)"/> </test1> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: parse-date.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> </test1> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: date-time.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:date-time() = date:date-time()"/> </test1> </out> </xsl:template> </xsl:stylesheet> --- NEW FILE: leap-year.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> <xsl:value-of select="date:leap-year(date)"/> </test1> <test2> <xsl:value-of select="date:leap-year('2004-04-01')"/> </test2> <test3> <xsl:value-of select="date:leap-year(bad-date)"/> </test3> <test4> <xsl:value-of select="date:leap-year('2000-04')"/> </test4> <test5> <xsl:value-of select="date:leap-year('2100')"/> </test5> </out> </xsl:template> </xsl:stylesheet> |
From: Oleg T. <he...@us...> - 2005-10-16 20:13:21
|
Update of /cvsroot/mvp-xml/EXSLT/v2/test/ExsltTest/results/EXSLT/Math In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14178/v2/test/ExsltTest/results/EXSLT/Math Added Files: abs.xml acos.xml asin.xml atan.xml atan2.xml constant.xml cos.xml exp.xml highest.xml log.xml lowest.xml max.xml min.xml power.xml random.xml sin.xml sqrt.xml tan.xml Log Message: --- NEW FILE: cos.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: atan2.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: power.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: abs.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: acos.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: sin.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: random.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: min.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: exp.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: log.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: tan.xml --- <out> <test1>-3.3801404139609579</test1> <test2>-1.2833247024302064</test2> <test3>NaN</test3> <test4>NaN</test4> <test5>NaN</test5> </out> --- NEW FILE: max.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: constant.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: atan.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: highest.xml --- <out> <test1> Max orders: <order>999.99</order><order>999.99</order></test1> <test2> Max orders: </test2> <test3> Max orders: </test3> </out> --- NEW FILE: sqrt.xml --- (This appears to be a binary file; contents omitted.) --- NEW FILE: lowest.xml --- <out> <test1> lowest orders: <order>1.99</order><order>1.99</order></test1> <test2> lowest orders: </test2> <test3> lowest orders: </test3> </out> --- NEW FILE: asin.xml --- (This appears to be a binary file; contents omitted.) |
From: Oleg T. <he...@us...> - 2005-10-16 20:13:21
|
Update of /cvsroot/mvp-xml/EXSLT/v2/test/ExsltTest/tests/GotDotNet/Math In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14178/v2/test/ExsltTest/tests/GotDotNet/Math Added Files: avg.xslt source.xml Log Message: --- NEW FILE: source.xml --- <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="avg.xslt"?> <data> <values> <value>7</value> <value>11</value> <value>8</value> <value>4</value> <bad-value>12a</bad-value> </values> </data> --- NEW FILE: avg.xslt --- <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:math2="http://gotdotnet.com/exslt/math" exclude-result-prefixes="math2"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="data"> <out> <test1> Average value: <xsl:value-of select="math2:avg(values/value)"/>. </test1> <test2> Average value: <xsl:value-of select="math2:avg(values/bad-value)"/>. </test2> <test3> Average value: <xsl:value-of select="math2:avg(no/such/nodes)"/>. </test3> </out> </xsl:template> </xsl:stylesheet> |