Re: [xslt] Query for multiple substring-after (before) calls



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:
  
Daniel,
I use following code to transform my stylesheets:
    

  use the command line tool xsltproc -v to test, please !
Did you read http://xmlsoft.org/XSLT/bugs.html ? Can you follow the procedure ?

  
My Input XML is:
<?xml version="1.0"?>
<precli>
       <param>
               <param-parent>rahul anil pandey tiwari sharma babu</param-parent>
       </param>
</precli>

My XSLT File is:

<?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'),'&#x20;'))}"/>
<!--  <xsl:element name="{normalize-space(substring-before(.,'&#x20;'))}"/> -->
                                       </xsl:for-each>
                               </key>
                       </ike>
               </crypto>
       </xsl:template>
</xsl:stylesheet>
    

  break you big _expression_ and use xsltproc -v to debug what is going on.
Sorry that's debugging you should be able to do and not rely on me do to,
Plus putting all the content in the content of the mail and not as attachment
there is no garantee I get exactly what you are trying with. Please be
rigorous and follow the steps and what I asked. I here to help users, but
I can't debug other people code.

Daniel

  

<?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'),'&#x20;'))}"/>
                                              <!--  <xsl:element name="{normalize-space(substring-before(.,'&#x20;'))}"/> -->

					</xsl:for-each>
				</key>
			</ike>
		</crypto>
	</xsl:template>
</xsl:stylesheet>


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