|
Daniel, Following is the output from xsltproc. Somehow I feel is that root-cause of the problem could be in xpath.c in libxml, where whitespaces are stripped from xpath. [root localhost xslttest]# xsltproc -v xslfile.xsl daniel.xml creating dictionary for stylesheet reusing dictionary from xslfile.xsl for stylesheet Added namespace: xsl mapped to http://www.w3.org/1999/XSL/Transform Added namespace: str mapped to http://exslt.org/strings exclude result prefix str xsltParseStylesheetProcess : found stylesheet exclude result prefix str xsltPrecomputeStylesheet: removing ignorable blank node xsltCompilePattern : parsing '/' xsltCompilePattern : parsed /, default priority 0.500000 added pattern : '/' priority 0.500000 parsed 1 templates Resolving attribute sets references Creating sub-dictionary from stylesheet for transformation Registered 0 modules reusing transformation dict for output Registering global variables Registering global variables from xslfile.xsl xsltProcessOneNode: applying template '/' for / xsltApplyOneTemplate: copy node crypto xsltApplyOneTemplate: copy node ike xsltApplyOneTemplate: copy node key xsltForEach: select /precli/param/param-parent xsltForEach: select evaluates to 1 nodes xsltEvalXPathString: returns xsltEvalAttrValueTemplate: {normalize-space(substring-before(substring-after(.,'pandey'),' '))} returns runtime error: file xslfile.xsl line 9 element element xsl:element : invalid name freeing transformation dictionnary no result for daniel.xml freeing dictionary from stylesheet [root localhost xslttest]# xsltproc --version Using libxml 20624, libxslt 10115 and libexslt 812 xsltproc was compiled against libxml 20624, libxslt 10115 and libexslt 812 libxslt 10115 was compiled against libxml 20624 libexslt 812 was compiled against libxml 20624 Daniel Veillard wrote: On Wed, May 03, 2006 at 02:24:32PM +0530, Rahul wrote: |
<?xml version="1.0"?> <precli> <param> <param-parent>rahul anil pandey tiwari sharma babu</param-parent> </param> </precli>
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" exclude-result-prefixes="str"> <xsl:output method="xml" indent="yes"/> <xsl:template match="/"> <crypto> <ike> <key> <xsl:for-each select="/precli/param/param-parent"> <xsl:element name="{normalize-space(substring-before(substring-after(.,'pandey'),' '))}"/> <!-- <xsl:element name="{normalize-space(substring-before(.,' '))}"/> --> </xsl:for-each> </key> </ike> </crypto> </xsl:template> </xsl:stylesheet>