Sorry, I didn't really understand the context of your problem. However, the
results proof that substring-after and substring-before function correctly.
If you don't get the expected result as you explained, there must be an
error somewhere else. My suggestion would be double check your stylesheet.
If you really think there is a bug in xalan, you can submit it to bugzilla
with a test case. http://nagoya.apache.org/bugzilla/  It will help us to
analyze the problem and keep on tracking bugs.

Thanks,

Christine Li
XSLT Development
IBM Toronto Lab
Tel: (905)413-2601
Email: [EMAIL PROTECTED]


                                                                                
                                                       
                      "du Plessis,                                              
                                                       
                      Corneil  C"              To:       Christine 
Li/Toronto/[EMAIL PROTECTED]                                                
                      <[EMAIL PROTECTED]        cc:                             
                                                        
                      c.co.za>                 Subject:  RE: substring-after 
and substring-before                                      
                                                                                
                                                       
                      05/21/2003 12:32                                          
                                                       
                      PM                                                        
                                                       
                                                                                
                                                       
                                                                                
                                                       



The results you show are expected when no parameters are supplied but when
searchdn is ou=dummy2 and reaplcedn is ou=dummy2_test the out should
contian lines like:


dn: cn=xyz,cn=config,ou=dummy2_test,o=dummycorp.com


I only get: ou=dummy2_test
which makes me think substring-before and substring-after are not producing
any results.


-----Original Message-----
From: Christine Li [mailto:[EMAIL PROTECTED]
Sent: 21 May, 2003 17:19
To: du Plessis, Corneil C
Cc: [EMAIL PROTECTED]
Subject: RE: substring-after and substring-before









Hi, Corneil


I can't reproduce any error. What is your expected result? I modified your
stylesheet to execute the substring-before and substring-after functions:


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:dsml

="http://www.dsml.org/DSML"; version="1.0">
<xsl:output method="text" encoding="UTF-8" media-type="text/txt"
omit-xml-declaration="yes" />
<xsl:param name="searchdn" select="string('')"/>
<xsl:param name="replacedn" select="string('')"/>
<xsl:template match="/">
        <xsl:if test="string-length($searchdn) != 0">
                <xsl:message>Replacing <xsl:value-of select="$searchdn"/>
with <xsl:value-of select="$replacedn"/></xsl:message>
        </xsl:if>
        <xsl:apply-templates select=
"dsml:dsml/dsml:directory-entries/dsml:entry"/>
        <xsl:text disable-output-escaping="yes">&#xA;</xsl:text>
</xsl:template>
<xsl:template match="dsml:entry" name="entry">
        <xsl:if test="string-length($searchdn) = 0">
                <xsl:text disable-output-escaping="yes">&#xA;dn: </xsl:text

>
                0<xsl:value-of select="@dn"/>
                1<xsl:value-of select="substring-before(@dn,$searchdn)"/>
                2<xsl:value-of select="substring-after(@dn,$searchdn)"/>
                3<xsl:value-of select=
"concat(substring-before(@dn,$searchdn),$replacedn,substring-after(@dn,$searchdn))"

/>
        </xsl:if>





 </xsl:template>
</xsl:stylesheet>


As far as I can tell, the result is correct. I got the same result using
both Xalan interpretive and xsltc.





dn:
                0cn=config,ou=dummy2,o=dummycorp.com
                1
                2cn=config,ou=dummy2,o=dummycorp.com
                3cn=config,ou=dummy2,o=dummycorp.com
dn:
                0cn=xyz,cn=config,ou=dummy2,o=dummycorp.com
                1
                2cn=xyz,cn=config,ou=dummy2,o=dummycorp.com
                3cn=xyz,cn=config,ou=dummy2,o=dummycorp.com
dn:


0cid=statement_config,cn=xyz,cn=config,ou=dummy2,o=dummycorp.com
                1


2cid=statement_config,cn=xyz,cn=config,ou=dummy2,o=dummycorp.com


3cid=statement_config,cn=xyz,cn=config,ou=dummy2,o=dummycorp.com
dn:


0cn=inputParams,cid=statement_config,cn=xyz,cn=config,ou=dummy2,o=dummycorp.com

                1


2cn=inputParams,cid=statement_config,cn=xyz,cn=config,ou=dummy2,o=dummycorp.com



3cn=inputParams,cid=statement_config,cn=xyz,cn=config,ou=dummy2,o=dummycorp.com






Christine Li
XSLT Development
IBM Toronto Lab
Tel: (905)413-2601
Email: [EMAIL PROTECTED]







                      "du Plessis,


                      Corneil  C"              To:       Christine
Li/Toronto/[EMAIL PROTECTED],


                      <[EMAIL PROTECTED]        cc:


                      c.co.za>                 Subject:  RE:
substring-after and substring-before




                      05/21/2003 10:08


                      AM










In response to Christine Li:








Ant Task:





<style style="dsml2ldif.xsl" processor="trax" force="{dsml.stylesheetnew}"
includes="**/*.dsml" excludes="**/*_test.dsml" extension="_test.ldif"
destdir=".">





        <param name="searchdn" expression="'ou=dummy2'"/>
        <param name="replacedn" expression="'ou=dummy2_test'"/>
</style>





Here is a short xml file:





<dsml xmlns="http://www.dsml.org/DSML"; xmlns:bcml="
http://www.sbsa.com/2002/BCML";>
        <!-- Name: statements-->
        <!-- Version: 1.0-->
        <!-- Container: dummy2-->
        <!-- Domain: dummycorp.com-->
        <directory-entries>
                <!--Entry should be created by administrator. dn:
ou=dummy2,o=dummycorp.com-->
                <!--Configuration-->
                <entry dn="cn=config,ou=dummy2,o=dummycorp.com">
                        <objectclass>
                                <oc-value>top</oc-value>
                                <oc-value>container</oc-value>
                        </objectclass>
                        <attr name="cn">
                                <value>config</value>
                        </attr>
                </entry>
                <entry dn="cn=xyz,cn=config,ou=dummy2,o=dummycorp.com">
                        <objectclass>
                                <oc-value>top</oc-value>
                                <oc-value>container</oc-value>
                        </objectclass>
                        <attr name="cn">
                                <value>globus</value>
                        </attr>
                </entry>
                <entry
dn="cid=statement_config,cn=xyz,cn=config,ou=dummy2,o=dummycorp.com">
                        <objectclass>
                                <oc-value>top</oc-value>
                                <oc-value>cimManagedElement</oc-value>
                                <oc-value>cimConfiguration</oc-value>
                                <oc-value>ePropertySet</oc-value>
                        </objectclass>
                        <attr name="cid">
                                <value>statement_config</value>
                        </attr>
                </entry>
                <entry
dn="cn=inputParams,cid=statement_config,cn=xyz,cn=config,ou=dummy2,o=dummycorp.com">



                        <objectclass>
                                <oc-value>top</oc-value>
                                <oc-value>container</oc-value>
                        </objectclass>
                        <attr name="cn">
                                <value>inputParams</value>
                        </attr>
                </entry>
        </directory-entries>
</dsml>





-----Original Message-----
From: Christine Li [mailto:[EMAIL PROTECTED]
Sent: 21 May, 2003 15:27
To: du Plessis, Corneil C
Cc: [EMAIL PROTECTED]
Subject: Re: substring-after and substring-before












Hi, Corneil





With your stylesheet only, there is not enough information for me to tell
whether it is a problem of your stylesheet or it is a bug in
substring-after function. Would you please provide your xml file as well?





Christine Li
XSLT Development
IBM Toronto Lab
Tel: (905)413-2601
Email: [EMAIL PROTECTED]










                      "du Plessis,





                      Corneil  C"              To:
[EMAIL PROTECTED]





                      <[EMAIL PROTECTED]        cc:





                      c.co.za>                 Subject:  substring-after
and substring-before







                      05/21/2003 04:49





                      AM













I have a problem with substring-before and substring-after.








A transformation that worked with Xalan 1.x stopped working when I moved up


to 2.x I have tried 2.5.0 and 2.4.1 with no success.








Has anyone experienced a similar problem?
Am I doing someting wrong?








This XSL converts DSML to LDIF and will optionaly replace a portion of a DN


with a new value.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:dsml="http://www.dsml.org/DSML"; version="1.0">
<xsl:output method="text" encoding="UTF-8" media-type="text/txt"
omit-xml-declaration="yes" />
<xsl:param name="searchdn" select="string('')"/>
<xsl:param name="replacedn" select="string('')"/>
<xsl:template match="/">
        <xsl:if test="string-length($searchdn) != 0">
                <xsl:message>Replacing <xsl:value-of select="$searchdn"/>
with <xsl:value-of select="$replacedn"/></xsl:message>








        </xsl:if>
        <xsl:apply-templates
select="dsml:dsml/dsml:directory-entries/dsml:entry"/>
        <xsl:text disable-output-escaping="yes">&#xA;</xsl:text>
</xsl:template>
<xsl:template match="dsml:entry" name="entry">
        <xsl:if test="string-length($searchdn) != 0">
                <xsl:text disable-output-escaping="yes">&#xA;dn:
</xsl:text><xsl:value-of
select="concat(substring-before(@dn,$searchdn),$replacedn,substring-after(@dn,$searchdn))"/>










        </xsl:if>
        <xsl:if test="string-length($searchdn) = 0">
                <xsl:text disable-output-escaping="yes">&#xA;dn:
</xsl:text><xsl:value-of select="@dn"/>
        </xsl:if>
        <xsl:for-each select="dsml:objectclass/dsml:oc-value">
                <xsl:text disable-output-escaping="yes">&#xA;objectclass:
</xsl:text><xsl:value-of select="text()"/>
        </xsl:for-each>
        <xsl:for-each select="dsml:attr/dsml:value">
                <xsl:if test="boolean(string-length(text()) > 0) or
boolean(normalize-space(text()) != ' ')">
                        <xsl:text
disable-output-escaping="yes">&#xA;</xsl:text><xsl:value-of
select="../@name"/>: <xsl:value-of select="text()"/>








                </xsl:if>
        </xsl:for-each>
        <xsl:text disable-output-escaping="yes">&#xA;</xsl:text>
 </xsl:template>
</xsl:stylesheet>








Corneil du Plessis
Technical Specialist
Internet Development
Retail Channels
Standard Bank
Direct +27 (11) 636-2210
Mobile +27 (83) 442-9221
ICQ# 66747137








__________________________________________________________________________________________________________________________________





For information about the Standard Bank group visit our web site <
www.standardbank.co.za>
__________________________________________________________________________________________________________________________________








Disclaimer and confidentiality note
Everything in this e-mail and any attachments relating to the official
business of Standard Bank Group Limited  is proprietary to the group.
It is confidential, legally privileged and protected by law.
Standard Bank does not own and endorse any other content. Views and
opinions are those of the sender unless clearly stated as being that of the


group.
The person addressed in the e-mail is the sole authorised recipient. Please


notify the sender immediately if it has unintentionally reached you and do
not read,
disclose or use the content in any way.
Standard Bank can not assure that the integrity of this communication has
been maintained nor that it is free of errors, virus, interception or
interference.
___________________________________________________________________________________________________________________________________





__________________________________________________________________________________________________________________________________


For information about the Standard Bank group visit our web site <
www.standardbank.co.za>
__________________________________________________________________________________________________________________________________





Disclaimer and confidentiality note
Everything in this e-mail and any attachments relating to the official
business of Standard Bank Group Limited  is proprietary to the group.
It is confidential, legally privileged and protected by law.
Standard Bank does not own and endorse any other content. Views and
opinions are those of the sender unless clearly stated as being that of the

group.
The person addressed in the e-mail is the sole authorised recipient. Please

notify the sender immediately if it has unintentionally reached you and do
not read,
disclose or use the content in any way.
Standard Bank can not assure that the integrity of this communication has
been maintained nor that it is free of errors, virus, interception or
interference.
___________________________________________________________________________________________________________________________________


__________________________________________________________________________________________________________________________________
For information about the Standard Bank group visit our web site <
www.standardbank.co.za>
__________________________________________________________________________________________________________________________________


Disclaimer and confidentiality note
Everything in this e-mail and any attachments relating to the official
business of Standard Bank Group Limited  is proprietary to the group.
It is confidential, legally privileged and protected by law.
Standard Bank does not own and endorse any other content. Views and
opinions are those of the sender unless clearly stated as being that of the
group.
The person addressed in the e-mail is the sole authorised recipient. Please
notify the sender immediately if it has unintentionally reached you and do
not read,
disclose or use the content in any way.
Standard Bank can not assure that the integrity of this communication has
been maintained nor that it is free of errors, virus, interception or
interference.
___________________________________________________________________________________________________________________________________


Reply via email to