[xslt] xsl:template
- From: Jon Cast <jcast ou edu>
- To: xslt gnome org
- Subject: [xslt] xsl:template
- Date: Mon, 16 Apr 2001 22:22:46 -0500
Greetings all,
The xsl:template tag defined in section 5.3 of the XSL Transforms
specification
(http://www.w3.org/TR/xslt.html#section-Defining-Template-Rules) does
not seem to be supported by libxslt 0.7. I have attached a test case
showing the problem. I have also attached the output from compiling
and running is the testcase.
I do not understand the libxslt source well enough to understand how
to fix it. However, I am willing to try if anyone can give me some
pointers on where to begin.
Jon Cast
/* template_test -- Tries a simple XSL transform using xsl:template */
#include<stdio.h>
#include<libxml/parserInternals.h>
#include<libxslt/xsltInternals.h>
#include<libxslt/transform.h>
int
main(argc, argv)
int argc;
char **argv;
{
xsltStylesheetPtr style_sheet;
xmlDocPtr input_doc;
xmlDocPtr transformed_doc;
/* Configure libxml to handle xsl files */
xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = 1;
/* Parse script */
style_sheet = xsltParseStylesheetFile("test.xsl");
input_doc = xmlParseFile("test.xml");
transformed_doc = xsltApplyStylesheet(style_sheet, input_doc,
NULL);
xmlIndentTreeOutput = 1;
xsltSaveResultToFile(stdout, transformed_doc, style_sheet);
return(0);
}
<xml>
<el1>
<p>This is included</p>
</el1>
<el2>
<p>This isn't</p>
</el2>
</xml>
Included from input:
$ make
gcc -c -g template_test.c -o template_test.o
gcc -o template_test template_test.o -lxslt -lxml2
$ ./template_test
xsltStylePreCompute: unknown xslt:template
xsltApplyOneTemplate: problem with xsl:template