After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 340503 - substring-after exits, if space is provided as an argument in nested call
substring-after exits, if space is provided as an argument in nested call
Status: RESOLVED NOTABUG
Product: libxslt
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2006-05-03 10:04 UTC by Rahul Sharma
Modified: 2006-05-03 11:48 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Rahul Sharma 2006-05-03 10:04:05 UTC
Most of the string related functions fail if space is provided as an argument, when these functions themselves are parameter to another function.

i.e. <xsl:element name="{normalize-space(substring-before(.,'&#x20;'))}"/>
works fine but,

<xsl:element name="{normalize-space(substring-before(substring-after(.,'pandey'),'&#x20;'))}"/>

fails, and returns with error.

[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


xslfile.xsl
<?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>



daniel.xml

<?xml version="1.0"?>
<precli>
	<param>
		<param-parent>
                        rahul anil pandey tiwari sharma babu 
                </param-parent>
	</param>
</precli>
Comment 1 Daniel Veillard 2006-05-03 11:48:45 UTC
Not a bug, the string starts with a space so the substring-before( , '&#x20;')
operation returns an empty string, perfectly normal.

Daniel