[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [xml] registering a extension module in libxslt (solved)
- From: Stefan Kost <kost imn htwk-leipzig de>
- To: Stefan Kost <kost imn htwk-leipzig de>
- Cc: xml gnome org
- Subject: Re: [xml] registering a extension module in libxslt (solved)
- Date: Fri, 26 Mar 2004 13:04:56 +0100
irks, found it myself. Need to add 'xsl:extension-element-prefixes'
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:i18n="<URI>"
xmlns="http://gitk.sourceforge.net/"
xsl:extension-element-prefixes="i18n"
I am not sure why not all extension do need it? Hava look at
libxslt-1.1.4/tests/extensions/ list.xsl and module.xsl
ciao
Stefan
Stefan Kost wrote:
> hi all,
>
> below is a code snippet, when executing it and loading the stylesheet the
> extension module initialisation gets not triggered and later I get:
>
> libxslt-error: xsltValueOf: text copy failed
> [gitk-core:gitkerrors.c:95] : libxml-error: xmlXPathCompOpEval: function gettext
> not found
> [gitk-core:gitkerrors.c:95] : libxml-error: Unregistered function
>
> The URI does definitely match (it uses the same constant definition).
> I had a look at the libxslt source, but e.g. things like
> xsltRegisterExtFunction() are not called verbatim anymore (params come from hashes).
>
> @daniel could you please extend the example at
> http://xmlsoft.org/XSLT/extensions.html
> with example calls to xsltRegisterExtModule() and xsltRegisterExtFunction() and
> a xslt snipped that is using the extension?
>
> Many thanks
> Stefan
>
> --------------
>
> ...
> if(xsltRegisterExtModule(I18N_NS_URL,xsltExtInit_i18n,xsltExtShutdown_i18n)) {
> gitk_err("failed to register extension modules (i18n)");
> result=FALSE;
> }
> ...
> if(!(xsl_i18n=xsltParseStylesheetFile(XSL_PATH"i18n.xsl"))) {
> gitk_err("failed to load stylesheet (i18n.xsl)");
> result=FALSE;
> }
> ...
>
> void *xsltExtInit_i18n(xsltTransformContextPtr ctxt, const xmlChar *URI) {
> gitk_log_intro();
> gitk_log1(">>>>>>>>>> URI=\"%s\"",URI);
> if(xsltRegisterExtFunction(
> ctxt,"gettext",URI,xmlXPathEvalFunc_i18n_gettext)
> ) {
> gitk_err("failed to register extension function (i18n)");
> }
> gitk_log_outro();
> return(NULL);
> }
>
> void xsltExtShutdown_i18n(xsltTransformContextPtr ctxt,const xmlChar *URI,void
> *data) {
> }
>
> void xmlXPathEvalFunc_i18n_gettext(xmlXPathParserContextPtr ctxt, int nargs) {
> gitk_log_intro();
> gitk_log1(">>>>>>>>>> nargs=%d",nargs);
> gitk_log_outro();
> }
>
> -----------------
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:giml="http://gitk.sourceforge.net/"
> xmlns:i18n="<I18N_NS_URL>"
> xmlns="http://gitk.sourceforge.net/"
> exclude-result-prefixes="giml">
>
> <xsl:output method="xml" doctype-system="http://gitk.sourceforge.net/giml.dtd"/>
>
> <xsl:template match="i18n:text">
> <xsl:value-of select="i18n:gettext(.)"/>
> </xsl:template>
> ...
>
--
\|/ Stefan Kost
<@ @> private business
+-oOO-(_)-OOo------------------------------------------------------ - - - - -
| __ Address Simildenstr. 5 HTWK Leipzig, Fb IMN, Postfach 301166
| /// 04277 Leipzig 04251 Leipzig
| __ /// Germany Germany
| \\\/// Phone +49341 2253538 +49341 30766101
| \__/ EMail st_kost_at_gmx.net kost_at_imn.htwk-leipzig.de
| WWW www.sonicpulse.de www.imn.htwk-leipzig.de/~kost/about.html
===-=-=--=---=---------------------------------- - - - - -
begin:vcard
fn:Stefan Kost
n:Kost;Stefan
org:HTWK Leipzig;FB. IMN
adr:;;Postfach 301166;Leipzig;;04251;Germany
email;internet:kost imn htwk-leipzig de
title:Dipl. Informatiker
tel;work:+49341 30766440
tel;home:+49341 2253538
tel;cell:+49178 3183742
x-mozilla-html:FALSE
url:http://www.imn.htwk-leipzig.de/~kost/about.html
version:2.1
end:vcard
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]