I have some XQuery files, which are generally crafted for syntax checking of atomic types xs:ID and xs:IDREF.
Is there any pure XSLT way (except any third party like zorba! or marklogic or without using java custom extension functions.
So far I've thought to write extension functions(using «xsl:function»). If anyone have any other idea? Suggestions are welcome.
If you want to mix XSLT and XQuery then I think you need a product allowing that with the help of extension functions, like Saxon does with http://www.saxonica.com/documentation/extensions/functions/query.xml.
Related
I am currently using the Apache Xalan XSLT processor in my Java application, but I would like to use some alternative solution which supports use of extension functions. Xalan seems to be out of date and buggy. I know of Saxonixa Saxon, but it is closed sourced. Is there some open source and well working alternative?
The current open source version of Saxon, Saxon-HE 9.9, supports "integrated extension functions" (functions written to a particular Saxon-defined Java interface). It doesn't support "reflexive" extension functions (calls to arbitrary Java classes/methods found on the classpath).
Note that if you move to Saxon, with support for XSLT 2.0 and 3.0, you will find there is much less need for calling out to Java, because (a) the built-in function library is much larger, and (b) you can implement your own functions using the xsl:function declaration.
I am going to make a xslt from data in Calc.
Really I need to replace some data in ready xml files.
I supposed to use a RegEx but sometimes I need to add/delete more siblings.
So XSLT would be a good here.
I played with xslt filters, it works, but not enough for me.
I'd do it from macros.
I think it is possible, but I have not found any template or even comprehensive docs.
I'm new for UNO.
Can you help me to find any appropriate template for BASIC or C++ or any.
Or reference to any docs concerning.
Thank you.
Java and Python have good XML parsing and regular expression libraries. I typically use xml.dom.minidom and re for Python. See here for "Hello World" type macros in these languages.
Basic does not have its own library, although there is an UNO service that provides a SAX style parser. See section 5.38 of Andrew Pitonyak's macro document for an example.
For C++, I typically avoid a lot of string processing or macro writing because it is a lower level language. However there are probably XML parsing libraries available, and macros can be written with some effort.
I have to admit that I'm still using Visual C++ 6 and don't plan to upgrade any time soon due to the complexity of the project I'm working on.
Can anyone provide me an example to transform XML data with XSLT stylesheet using Visual C++ 6 in unmanaged code? If this old workhorse doesn't have that feature, which component is considered to be the best in the market?
From Windows apps one XSLT processor to use is the COM object as part of the MSXML SDK. (I have used early versions of this with VS6 but as it is COM I can't see why this will not work with the latest version)
You can also use pure C/C++ libraries such as Xalan or Aribica
You could have a look at the answers to this SO question: 'Is there any C++ XSLT library?'.
Apache Xalan looks to be appropriate, though I have no personal experience with this lib.
Another option is to run the XSLT processor (executable) directly from your program via system() call or similar mechanism.
If you really need a COM component to achieve what you want, you might consider to wrap one of these solutions in your own COM component implementation.
I'm using Mvp.Xsl.dll implementation of EXSLT. I'm having hard time to create a custom function and call it from XPath. Is this possible? Can you provide one very simple example?
Thanks a lot,
Petr
Exslt.Net doesn't implement the EXSLT <func:function> extension element.
I would strongly recommend to start using XSLT 2.0 and its <xsl:function> instruction.
Need to write some C++ code that reads XML string and if i do
something like:
get valueofElement("ACTION_ON_CARD") it returns 3
get valueofElement("ACTION_ON_ENVELOPE") it returns YES
XML String:
<ACTION_ON_CARD>3</ACTION_ON_CARD>
<ACTION_ON_ENVELOPE>YES</ACTION_ON_ENVELOPE>
Any code example would be helpfull
Thanks
writing an xml parser is not necessarily an easy thing to do, so unless it is a requirement you do it yourself I suggest you get a library to do that for you.
There are many available like xerces (pretty complete but not exactly simple), tinyxml (mostly the opposite of xerces, it probably suits best your needs) or libxml (never tried this one)
If you have the schema, you could use codesynthesis xsd compiler.
I recommend the XML parser from the Poco C++ library. It's well documented and easy to use.