You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sh...@apache.org on 2012/02/21 06:06:50 UTC

svn commit: r1291596 - in /xalan/c/trunk: samples/UseStylesheetParam/ src/xalanc/XalanTransformer/

Author: shathaway
Date: Tue Feb 21 05:06:49 2012
New Revision: 1291596

URL: http://svn.apache.org/viewvc?rev=1291596&view=rev
Log:
Add Number and Nodeset Top-Level Parameter support for XalanCAPI

Added:
    xalan/c/trunk/samples/UseStylesheetParam/TestCAPIparm.c
    xalan/c/trunk/samples/UseStylesheetParam/foo.xslt
    xalan/c/trunk/samples/UseStylesheetParam/parmA.xml
    xalan/c/trunk/samples/UseStylesheetParam/parmB.xml
Removed:
    xalan/c/trunk/samples/UseStylesheetParam/foo.xsl
Modified:
    xalan/c/trunk/samples/UseStylesheetParam/UseStylesheetParam.cpp
    xalan/c/trunk/samples/UseStylesheetParam/foo.xml
    xalan/c/trunk/src/xalanc/XalanTransformer/XalanCAPI.cpp
    xalan/c/trunk/src/xalanc/XalanTransformer/XalanCAPI.h

Added: xalan/c/trunk/samples/UseStylesheetParam/TestCAPIparm.c
URL: http://svn.apache.org/viewvc/xalan/c/trunk/samples/UseStylesheetParam/TestCAPIparm.c?rev=1291596&view=auto
==============================================================================
--- xalan/c/trunk/samples/UseStylesheetParam/TestCAPIparm.c (added)
+++ xalan/c/trunk/samples/UseStylesheetParam/TestCAPIparm.c Tue Feb 21 05:06:49 2012
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the  "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Test of XalanCAPI.h
+ * With Top-Level Parameters
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xalanc/XalanTransformer/XalanCAPI.h"
+
+int Usage(const char * program)
+{
+    printf("\nUSAGE: %s xml-file  stylesheet  outfile  [parameters...]\n"
+        "   Parameter: -s name \"'string'\"\n"
+        "   Parameter: -n name 123.34532\n"
+        "   Parameter: -d name \"xmlfile\"\n",
+        program);
+    return 1;
+}
+
+
+struct {
+    char *  ParmType;
+    char *  ParmName;
+    char *  ParmValue;
+} ParamInfo[15];
+
+XalanPSHandle ParamPSHandle[15];
+
+XalanHandle theTransformer;
+char *      theXmlFile;
+char *      theXslFile;
+char *      theOutFile;
+
+
+int main(int argc, char * argv[])
+{
+
+    int i,j;
+    int ParamCount = 0;
+
+    if (argc < 4)
+        return Usage(argv[0]);
+
+    theXmlFile = argv[1];
+    theXslFile = argv[2];
+    theOutFile = argv[3];
+
+    for (i=4, j=0; i<argc ;i++)
+    {
+        if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "-n") || !strcmp(argv[i], "-d"))
+        {
+            ParamInfo[j].ParmType = argv[i];
+            i++;
+        }
+        else return Usage(argv[0]);
+
+        if (i == argc)
+            return Usage(argv[0]);
+        ParamInfo[j].ParmName = argv[i];
+        i++;
+        if (i == argc)
+            return Usage(argv[0]);
+        ParamInfo[j].ParmValue = argv[i];
+        ParamCount = ++j;
+    }
+            
+    XalanInitialize();
+
+    theTransformer = CreateXalanTransformer();
+    if (!theTransformer)
+    {
+        printf("ERROR: Unable to Create Xalan Transformer\n");
+        return Usage(argv[0]);
+    }
+
+    for (i = 0; i < ParamCount; i++)
+    {
+        if (!strcmp(ParamInfo[i].ParmType, "-s"))
+        {
+            XalanSetStylesheetParam(ParamInfo[i].ParmName, 
+                ParamInfo[i].ParmValue,
+                theTransformer);
+        }
+        else if (!strcmp(ParamInfo[i].ParmType, "-n"))
+        {
+            XalanSetStylesheetParamNumber(ParamInfo[i].ParmName,
+                strtod(ParamInfo[i].ParmValue, NULL),
+                theTransformer);
+        }
+        else if (!strcmp(ParamInfo[i].ParmType, "-d"))
+        {
+            if (XalanParseSource(ParamInfo[i].ParmValue,
+                theTransformer,
+                &ParamPSHandle[i]))
+            {
+                //ERRPR
+                printf("ERROR: Unable to create Nodeset %s\n",
+                    ParamInfo[i].ParmValue);
+                return Usage(argv[0]);
+            }
+            XalanSetStylesheetParamNodeset(ParamInfo[i].ParmName,
+                ParamPSHandle[i],
+                theTransformer);
+        }
+    }
+
+
+    if (XalanTransformToFile(theXmlFile, theXslFile, theOutFile, theTransformer))
+    {
+        //ERROR
+        printf("ERROR: Transformation\n%s\n",
+             XalanGetLastError(theTransformer));
+        return 1;
+    }
+
+    for (i=0; i < ParamCount; i++)
+    {
+        if (!strcmp(ParamInfo[i].ParmType, "-d"))
+        {
+            XalanDestroyParsedSource(
+                ParamPSHandle[i],
+                theTransformer);
+        }
+
+    }
+
+    XalanClearStylesheetParams(theTransformer);
+
+    DeleteXalanTransformer(theTransformer);
+
+    XalanTerminate(0);
+    return 0;
+}

Modified: xalan/c/trunk/samples/UseStylesheetParam/UseStylesheetParam.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/samples/UseStylesheetParam/UseStylesheetParam.cpp?rev=1291596&r1=1291595&r2=1291596&view=diff
==============================================================================
--- xalan/c/trunk/samples/UseStylesheetParam/UseStylesheetParam.cpp (original)
+++ xalan/c/trunk/samples/UseStylesheetParam/UseStylesheetParam.cpp Tue Feb 21 05:06:49 2012
@@ -18,23 +18,49 @@
 
 #include <xalanc/Include/PlatformDefinitions.hpp>
 
-
-
 #if defined(XALAN_CLASSIC_IOSTREAMS)
 #include <iostream.h>
 #else
 #include <iostream>
 #endif
 
+#include <xercesc/util/PlatformUtils.hpp>
 
+#include <xalanc/XalanTransformer/XalanTransformer.hpp>
 
-#include <xercesc/util/PlatformUtils.hpp>
+// The next 2 include files are for parsing XML documents as nodeset parameters.
 
+#include <xalanc/XalanTransformer/XalanParsedSource.hpp>
+#include <xalanc/XSLT/XSLTInputSource.hpp>
 
+// DATA STORAGE FOR TOP-LEVEL PARAMETERS
+struct {
+    char *  parmType;   // -s key string, -n key number, -d key document
+    char *  parmName;   // the key or parameter name
+    char *  parmValue;  // the represented string value
+} Parameter[15];
+
+// The Parsed Document Nodesets
+XALAN_USING_XALAN(XalanParsedSource)
+const XalanParsedSource * NodesetParam[15] = {
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 
-#include <xalanc/XalanTransformer/XalanTransformer.hpp>
 
+// THE USAGE HELP FUNCTION
 
+int Usage()
+{
+    XALAN_USING_STD(cerr)
+    XALAN_USING_STD(endl)
+    cerr << "Usage: UseStylesheetParam xmlFile xslFile outFile [parameters]" <<endl
+         << "   Parameters are:" <<endl
+         << "   -s name \"'String Value'\"" <<endl
+         << "   -n name NumberValue" <<endl
+         << "   -d name \"Document Nodeset File\"" <<endl;
+    return 1;
+}
+
+// THE MAIN SAMPLE PROGRAM
 
 int
 main(
@@ -45,20 +71,34 @@ main(
     XALAN_USING_STD(endl)
 
     int theResult = 0;
+    int i, j;
+    int paramCount = 0;
 
-    if (argc != 3)
+    if (argc < 4)
     {
-        cerr << "Usage: UseStylesheetParam key expression" << endl;
+        return Usage();
+    }
+
+    // Collect the top-level parameter arguments
 
-        theResult = -1;
+    for (i=4, j=0; i < argc;)
+    {
+        if (!strcmp(argv[i],"-s") || !strcmp(argv[i],"-n") || !strcmp(argv[i],"-d"))
+        {
+            Parameter[j].parmType  = argv[i++];
+            Parameter[j].parmName  = argv[i++];
+            Parameter[j].parmValue = argv[i++];
+            paramCount = ++j;
+        }
+        else  return Usage();
     }
-    else
+
     {
         XALAN_USING_XERCES(XMLPlatformUtils)
         XALAN_USING_XERCES(XMLException)
 
-
         XALAN_USING_XALAN(XalanTransformer)
+        XALAN_USING_XALAN(XSLTInputSource)
 
         // Call the static initializer for Xerces.
         try
@@ -87,24 +127,79 @@ main(
                 // Create a XalanTransformer.
                 XalanTransformer    theXalanTransformer;
 
-                // Set the stylesheet parameter name and
-                // expression (a string expression).
-                theXalanTransformer.setStylesheetParam(
-                        XalanDOMString(argv[1]),
-                        XalanDOMString(argv[2]));
+                // Prepare and set the top-level parameters
+
+                for (j = 0; j < paramCount; j++)
+                {
+                    // The String Top-Level Parameters
+                    if (!strcmp(Parameter[j].parmType, "-s"))
+                    {
+                        theXalanTransformer.setStylesheetParam(
+                            Parameter[j].parmName,
+                            Parameter[j].parmValue);
+                    }
+
+                    // The DOUBLE Number Top-Level Parameters
+                    if (!strcmp(Parameter[j].parmType, "-n"))
+                    {
+                        theXalanTransformer.setStylesheetParam(
+                            Parameter[j].parmName,
+                            strtod(Parameter[j].parmValue, NULL));
+                    }
+
+                    // The Parsed XML Document (nodeset) Top-Level Parameters
+                    if (!strcmp(Parameter[j].parmType, "-d"))
+                    {
+//                      NodesetParam[j] = NULL;
+                        if (theXalanTransformer.parseSource(
+                                    XSLTInputSource(Parameter[j].parmValue,
+                                        theXalanTransformer.getMemoryManager()),
+                                    NodesetParam[j]) == 0)
+                        {
+                            theXalanTransformer.setStylesheetParam(
+                                Parameter[j].parmName,
+                                NodesetParam[j]->getDocument());
+                        }
+                        else
+                        {
+                            cerr << "WARNING: XML parsing error in "
+                                 << Parameter[j].parmName << " file: " 
+                                 << Parameter[j].parmValue <<endl
+                                 << theXalanTransformer.getLastError() <<endl <<endl;
+                        }
+                    }
+                }
 
                 // Our input files...The assumption is that the executable will be run
                 // from same directory as the input files.
-                theResult = theXalanTransformer.transform("foo.xml", "foo.xsl", "foo.out");
+                // argv[1]="foo.xml"
+                // argv[2]="foo.xslt"
+                // argv[3]="foo.out"
+                // -d parmA "parmA.xml"
+                // -d parmB "parmB.xml"
+                // -s stringA "'This is a test string'"
+                // -n numberA 432.12345
 
+                theResult = theXalanTransformer.transform(argv[1], argv[2], argv[3]);
                 if(theResult != 0)
                 {
                     cerr << "UseStylesheetParam Error: \n" << theXalanTransformer.getLastError()
                          << endl
                          << endl;
                 }
-            }
+  
+            // Clear the top-level parameters - Note: They are sticky across transformations.
+
+                theXalanTransformer.clearStylesheetParams();
+
+            // Destroy the parsed XML documents used as nodeset parameters.
 
+                for (j=0; j < paramCount; j++)
+                {
+                    if (!strcmp(Parameter[j].parmType, "-d") && NodesetParam[j])
+                        theXalanTransformer.destroyParsedSource(NodesetParam[j]);
+                }
+            }
             // Terminate Xalan...
             XalanTransformer::terminate();
         }

Modified: xalan/c/trunk/samples/UseStylesheetParam/foo.xml
URL: http://svn.apache.org/viewvc/xalan/c/trunk/samples/UseStylesheetParam/foo.xml?rev=1291596&r1=1291595&r2=1291596&view=diff
==============================================================================
--- xalan/c/trunk/samples/UseStylesheetParam/foo.xml (original)
+++ xalan/c/trunk/samples/UseStylesheetParam/foo.xml Tue Feb 21 05:06:49 2012
@@ -1,2 +1,5 @@
-<?xml version="1.0"?>
-<doc>Hello</doc>
+<root>
+ <Item>Item-1</Item>
+ <Item>Item-2</Item>
+ <Item>Item-3</Item>
+</root>

Added: xalan/c/trunk/samples/UseStylesheetParam/foo.xslt
URL: http://svn.apache.org/viewvc/xalan/c/trunk/samples/UseStylesheetParam/foo.xslt?rev=1291596&view=auto
==============================================================================
--- xalan/c/trunk/samples/UseStylesheetParam/foo.xslt (added)
+++ xalan/c/trunk/samples/UseStylesheetParam/foo.xslt Tue Feb 21 05:06:49 2012
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:param name="parmA"/>
+<xsl:param name="parmB"/>
+<xsl:param name="stringA"/>
+<xsl:param name="numberA" select="0.0"/>
+<xsl:template match="root">
+ <OUTPUT>
+ <NumberParam><xsl:value-of select="$numberA"/></NumberParam>
+ <xsl:copy-of select="."/>
+ <ParameterA><xsl:copy-of select="$parmA"/></ParameterA>
+ <ParameterB><xsl:copy-of select="$parmB"/></ParameterB>
+ <StringA><xsl:value-of select="$stringA"/></StringA>
+ </OUTPUT>
+</xsl:template>
+</xsl:stylesheet>

Added: xalan/c/trunk/samples/UseStylesheetParam/parmA.xml
URL: http://svn.apache.org/viewvc/xalan/c/trunk/samples/UseStylesheetParam/parmA.xml?rev=1291596&view=auto
==============================================================================
--- xalan/c/trunk/samples/UseStylesheetParam/parmA.xml (added)
+++ xalan/c/trunk/samples/UseStylesheetParam/parmA.xml Tue Feb 21 05:06:49 2012
@@ -0,0 +1,4 @@
+<xparm>
+ <Item>First A Item</Item>
+ <Item>Second A Item</Item>
+</xparm>

Added: xalan/c/trunk/samples/UseStylesheetParam/parmB.xml
URL: http://svn.apache.org/viewvc/xalan/c/trunk/samples/UseStylesheetParam/parmB.xml?rev=1291596&view=auto
==============================================================================
--- xalan/c/trunk/samples/UseStylesheetParam/parmB.xml (added)
+++ xalan/c/trunk/samples/UseStylesheetParam/parmB.xml Tue Feb 21 05:06:49 2012
@@ -0,0 +1,4 @@
+<xparm>
+ <Item>First B Item</Item>
+ <Item>Second B Item</Item>
+</xparm>

Modified: xalan/c/trunk/src/xalanc/XalanTransformer/XalanCAPI.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XalanTransformer/XalanCAPI.cpp?rev=1291596&r1=1291595&r2=1291596&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanTransformer/XalanCAPI.cpp (original)
+++ xalan/c/trunk/src/xalanc/XalanTransformer/XalanCAPI.cpp Tue Feb 21 05:06:49 2012
@@ -17,12 +17,8 @@
  */
 #include "XalanTransformerDefinitions.hpp"
 
-
-
 #include <xercesc/util/PlatformUtils.hpp>
 
-
-
 #include <cassert>
 #if defined(XALAN_CLASSIC_IOSTREAMS)
 #include <strstream.h>
@@ -30,16 +26,12 @@
 #include <strstream>
 #endif
 
-
-
 #include "XalanCAPI.h"
 #include "XalanTransformer.hpp"
-
-
+#include "XalanParsedSource.hpp"
 
 #include "xalanc/Include/XalanMemoryManagement.hpp"
 
-
 XALAN_USING_STD(istrstream)
 
 XALAN_USING_XALAN(XalanAllocationGuard)
@@ -58,7 +50,6 @@ XALAN_USING_XALAN(XSLTResultTarget)
 static bool fInitialized = false;
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
 XalanInitialize()
 {
@@ -80,7 +71,6 @@ XalanInitialize()
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
 XalanTerminate(int  fCleanUpICU)
 {
@@ -99,7 +89,6 @@ XalanTerminate(int  fCleanUpICU)
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(XalanHandle)
 CreateXalanTransformer()
 {   
@@ -120,7 +109,6 @@ CreateXalanTransformer()
 }
 
 
-
 inline XalanTransformer*
 getTransformer(XalanHandle  theHandle)
 {
@@ -130,7 +118,6 @@ getTransformer(XalanHandle  theHandle)
 }
 
 
-
 inline const XalanCompiledStylesheet*
 getStylesheet(XalanCSSHandle    theHandle)
 {
@@ -140,7 +127,6 @@ getStylesheet(XalanCSSHandle    theHandl
 }
 
 
-
 inline const XalanParsedSource*
 getParsedSource(XalanPSHandle   theHandle)
 {
@@ -150,7 +136,6 @@ getParsedSource(XalanPSHandle   theHandl
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
 DeleteXalanTransformer(XalanHandle theXalanHandle)
 {
@@ -166,7 +151,6 @@ DeleteXalanTransformer(XalanHandle theXa
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
 XalanTransformToFile(
             const char*     theXMLFileName, 
@@ -190,7 +174,6 @@ XalanTransformToFile(
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
 XalanTransformToFilePrebuilt(
             XalanPSHandle   theParsedSource, 
@@ -206,7 +189,6 @@ XalanTransformToFilePrebuilt(
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
 XalanTransformToData(
             const char*     theXMLFileName, 
@@ -254,7 +236,6 @@ XalanTransformToData(
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
 XalanTransformToDataPrebuilt(
             XalanPSHandle   theParsedSource, 
@@ -285,7 +266,6 @@ XalanTransformToDataPrebuilt(
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
 XalanFreeData(char* theStream)
 {
@@ -294,7 +274,6 @@ XalanFreeData(char* theStream)
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(int) 
 XalanTransformToHandler(
             const char*             theXMLFileName,
@@ -320,7 +299,6 @@ XalanTransformToHandler(
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(int) 
 XalanTransformToHandlerPrebuilt(
             XalanPSHandle           theParsedSource,
@@ -340,7 +318,6 @@ XalanTransformToHandlerPrebuilt(
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
 XalanCompileStylesheet(
             const char*         theXSLFileName,
@@ -369,7 +346,6 @@ XalanCompileStylesheet(
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
 XalanCompileStylesheetFromStream(
             const char*         theXSLStream,
@@ -401,7 +377,6 @@ XalanCompileStylesheetFromStream(
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
 XalanDestroyCompiledStylesheet(
             XalanCSSHandle  theCSSHandle,
@@ -411,7 +386,6 @@ XalanDestroyCompiledStylesheet(
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
 XalanParseSource(
             const char*     theXMLFileName,
@@ -440,7 +414,6 @@ XalanParseSource(
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
 XalanParseSourceFromStream(
             const char*     theXMLStream,
@@ -472,7 +445,6 @@ XalanParseSourceFromStream(
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
 XalanDestroyParsedSource(
             XalanPSHandle   thePSHandle,
@@ -482,7 +454,6 @@ XalanDestroyParsedSource(
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
 XalanSetStylesheetParam(
             const char*     key,
@@ -495,7 +466,6 @@ XalanSetStylesheetParam(
 }
 
 
-
 XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
 XalanSetStylesheetParamUTF(
                 const XalanUTF16Char*   key,
@@ -508,6 +478,61 @@ XalanSetStylesheetParamUTF(
 }
 
 
+XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
+XalanSetStylesheetParamNodeset(
+                const char*             key,
+                XalanPSHandle           theNodeset,
+                XalanHandle             theXalanHandle)
+{
+    getTransformer(theXalanHandle)->setStylesheetParam(
+        key,
+        getParsedSource(theNodeset)->getDocument());
+}
+
+
+XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
+XalanSetStylesheetParamUTFNodeset(
+                const XalanUTF16Char*   key,
+                XalanPSHandle           theNodeset,
+                XalanHandle             theXalanHandle)
+{
+    getTransformer(theXalanHandle)->setStylesheetParam(
+        XalanDOMString(key, XalanMemMgrs::getDefaultXercesMemMgr()),
+        getParsedSource(theNodeset)->getDocument());
+}
+        
+
+XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
+XalanSetStylesheetParamNumber(
+                const char*             key,
+                double                  theNumber,
+                XalanHandle             theXalanHandle)
+{
+    getTransformer(theXalanHandle)->setStylesheetParam(
+        key,
+        theNumber);
+}
+
+
+XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
+XalanSetStylesheetParamUTFNumber(
+                const XalanUTF16Char*   key,
+                double                  theNumber,
+                XalanHandle             theXalanHandle)
+{
+    getTransformer(theXalanHandle)->setStylesheetParam(
+        XalanDOMString(key, XalanMemMgrs::getDefaultXercesMemMgr()),
+        theNumber);
+}
+
+
+XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
+XalanClearStylesheetParams(
+                XalanHandle             theXalanHandle)
+{
+    getTransformer(theXalanHandle)->clearStylesheetParams();
+}
+
 
 XALAN_TRANSFORMER_EXPORT_FUNCTION(XalanCCharPtr)
 XalanGetLastError(XalanHandle theXalanHandle)

Modified: xalan/c/trunk/src/xalanc/XalanTransformer/XalanCAPI.h
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XalanTransformer/XalanCAPI.h?rev=1291596&r1=1291595&r2=1291596&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XalanTransformer/XalanCAPI.h (original)
+++ xalan/c/trunk/src/xalanc/XalanTransformer/XalanCAPI.h Tue Feb 21 05:06:49 2012
@@ -224,7 +224,7 @@ extern "C"
      * @param theOutputHandle   A void pointer passed through to callback.
      * @param theOutputHandler  A user-defined callback function pointer.
      * @param theFlushHandler   A user-defined callback function pointer, which can be null.
-     * @return	0 for success
+     * @return  0 for success
      */
     XALAN_TRANSFORMER_EXPORT_FUNCTION(int) 
     XalanTransformToHandler(
@@ -253,7 +253,7 @@ extern "C"
      * @param theOutputHandle   A void pointer passed through to callback.
      * @param theOutputHandler  A user-defined callback function pointer.
      * @param theFlushHandler   A user-defined callback function pointer, which can be null.
-     * @return	0 for success 
+     * @return  0 for success 
      */
     XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
     XalanTransformToHandlerPrebuilt(
@@ -313,7 +313,7 @@ extern "C"
      * @param theXalanHandle The handle of XalanTransformer instance.
      * @param thePSHandle A pointer to a XalanPSHandle
      * @return 0 for success.
-     */	
+     */ 
     XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
     XalanParseSource(
             const char*     theXMLFileName,
@@ -328,7 +328,7 @@ extern "C"
      * @param theXalanHandle The handle of XalanTransformer instance
      * @param thePSHandle A pointer to a XalanPSHandle
      * @return 0 for success.
-     */	
+     */ 
     XALAN_TRANSFORMER_EXPORT_FUNCTION(int)
     XalanParseSourceFromStream(
             const char*     theXMLStream,
@@ -370,7 +370,7 @@ extern "C"
      *
      * @param key name of the param
      * @param expression expression that will be evaluated
-     * @param theXalanHandle	handle of XalanTransformer instance.
+     * @param theXalanHandle    handle of XalanTransformer instance.
      */
     XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
     XalanSetStylesheetParamUTF(
@@ -378,6 +378,77 @@ extern "C"
                 const XalanUTF16Char*   expression,
                 XalanHandle             theXalanHandle);
 
+
+    /**
+     * Set a top-level stylesheet nodeset parameter.  This value can be
+     * evaluated via xsl:param-variable.  The value is a parsed document.
+     *
+     * @param key name of the param
+     * @param theNodeset a preparsed document
+     * @param theXalanHandle  handle of the XalanTransformer instance.
+     */
+    XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
+    XalanSetStylesheetParamNodeset(
+                const char*             key,
+                XalanPSHandle           theNodeset,
+                XalanHandle             theXalanHandle);
+
+    /**
+     * Set a top-level stylesheet nodeset parameter.  This value can be
+     * evaluated via xsl:param-variable.  The value is a parsed document.
+     * The key name is a UTF-16 string.
+     *
+     * @param key name of the param
+     * @param theNodeset a preparsed document
+     * @param theXalanHandle  handle of the XalanTransformer instance.
+     */
+    XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
+    XalanSetStylesheetParamUTFNodeset(
+                const XalanUTF16Char*   key,
+                XalanPSHandle           theNodeset,
+                XalanHandle             theXalanHandle);
+        
+    /**
+     * Set a top-level stylesheet number parameter.  This value can be
+     * evaluated via xsl:param-variable.  The value is a parsed document.
+     *
+     * @param key name of the param
+     * @param theNumber a double floating point number
+     * @param theXalanHandle  handle of the XalanTransformer instance.
+     */
+    XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
+    XalanSetStylesheetParamNumber(
+                const char*             key,
+                double                  theNumber,
+                XalanHandle             theXalanHandle);
+
+    /**
+     * Set a top-level stylesheet number parameter.  This value can be
+     * evaluated via xsl:param-variable.  The value is a parsed document.
+     * The key name is a UTF-16 string.
+     *
+     * @param key name of the param
+     * @param theNumber a double floating point number
+     * @param theXalanHandle  handle of the XalanTransformer instance.
+     */
+    XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
+    XalanSetStylesheetParamUTFNumber(
+                const XalanUTF16Char*   key,
+                double                  theNumber,
+                XalanHandle             theXalanHandle);
+
+    /**
+     * Clear the top-level stylesheet parameters.  Top-level stylesheet
+     * parameters are sticky.  When set, they can be used for multiple
+     * transformations. Use the XalanClearStylesheetParams function
+     * to clear or reset the top-level stylesheet parameters.
+     *
+     * @param theXalanHandle  handle of the XalanTransformer instance.
+     */
+    XALAN_TRANSFORMER_EXPORT_FUNCTION(void)
+    XalanClearStylesheetParams(
+                XalanHandle             theXalanHandle);
+
     /**
      * Returns the last error that occurred as a 
      * result of calling transform.
@@ -386,7 +457,7 @@ extern "C"
      * const char*
      * XalanGetLastError(XalanHandle theXalanHandle) const;
      *
-     * @return	error message const character pointer.
+     * @return  error message const character pointer.
      */
     XALAN_TRANSFORMER_EXPORT_FUNCTION(XalanCCharPtr)
     XalanGetLastError(XalanHandle   theXalanHandle);
@@ -397,4 +468,4 @@ extern "C"
 
 
 
-#endif	// XALAN_CAPI_HEADER_GUARD_1357924680
+#endif  // XALAN_CAPI_HEADER_GUARD_1357924680



---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org