[libxslt.wiki] Create FAQ



commit 872c118cfbb13069c880ebb6ce0359e63832b8a2
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Sun Feb 13 02:01:59 2022 +0000

    Create FAQ

 FAQ.md | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
---
diff --git a/FAQ.md b/FAQ.md
new file mode 100644
index 0000000..83b7835
--- /dev/null
+++ b/FAQ.md
@@ -0,0 +1,34 @@
+### Troubles compiling or linking programs using libxslt
+
+Usually the problem comes from the fact that the compiler doesn't get the right compilation or linking 
flags. There is a small shell script `xslt-config` which is installed as part of libxslt usual install 
process which provides those flags. Use
+
+`xslt-config --cflags`
+
+to get the compilation flags and
+
+`xslt-config --libs`
+
+to get the linker flags. Usually this is done directly from the Makefile as:
+
+`` CFLAGS=`xslt-config --cflags` ``
+
+`` LIBS=`xslt-config --libs` ``
+
+Note also that if you use the EXSLT extensions from the program then you should prepend `-lexslt` to the 
LIBS options
+
+### Passing parameters on the xsltproc command line doesn't work
+
+`xsltproc --param test alpha foo.xsl foo.xml`
+
+The param does not get passed and ends up as "".
+
+In a nutshell do a double escaping at the shell prompt:
+
+`xsltproc --param test "'alpha'" foo.xsl foo.xml`
+
+i.e. the string value is surrounded by " and ' then terminated by ' and ". Libxslt interpret the parameter 
values as XPath expressions, so the string ->`alpha`<- is intepreted as the node set matching this string. 
You really want ->`'alpha'`<- to be passed to the processor. And to allow this you need to escape the quotes 
at the shell level using ->`"'alpha'"`<- .
+
+or use
+
+`xsltproc --stringparam test alpha foo.xsl foo.xml`
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]