  | |  | substring-after and substring-before | substring-after and substring-before 2003-05-21 - By du Plessis, Corneil C
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">
</xsl:text> </xsl:template> <xsl:template match="dsml:entry" name="entry"> <xsl:if test="string-length($searchdn) != 0"> <xsl:text disable-output-escaping="yes">
dn: </xsl:text><xsl:value-of select="concat(substring-before(@(protected),$searchdn),$replacedn,substring-after(@(protected) n,$searchdn))"/> </xsl:if> <xsl:if test="string-length($searchdn) = 0"> <xsl:text disable-output-escaping="yes">
dn: </xsl:text><xsl:value-of select="@(protected)"/> </xsl:if> <xsl:for-each select="dsml:objectclass/dsml:oc-value"> <xsl:text disable-output-escaping="yes">
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">
</xsl:text><xsl:value-of select="../@(protected)"/>: <xsl:value-of select="text()"/> </xsl:if> </xsl:for-each> <xsl:text disable-output-escaping="yes">
</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. _______________________________________________________________________________ ____________________________________________________
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12"> <TITLE>substring-after and substring-before</TITLE> </HEAD> <BODY>
<P><FONT SIZE=2>I have a problem with substring-before and substring-after.< /FONT> </P>
<P><FONT SIZE=2>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.</FONT></P>
<P><FONT SIZE=2>Has anyone experienced a similar problem?</FONT> <BR><FONT SIZE=2>Am I doing someting wrong?</FONT> </P>
<P><FONT SIZE=2>This XSL converts DSML to LDIF and will optionaly replace a portion of a DN with a new value.</FONT> <BR><FONT SIZE=2><xsl:stylesheet xmlns:xsl="<A HREF="http://www.w3.org /1999/XSL/Transform" TARGET="_blank">http://www.w3.org/1999/XSL/Transform</A> " xmlns:dsml="<A HREF="http://www.dsml.org/DSML" TARGET="_blank">http: //www.dsml.org/DSML</A>" version="1.0"></FONT> <BR><FONT SIZE=2><xsl:output method="text" encoding="UTF-8 " media-type="text/txt" omit-xml-declaration="yes" /> ;</FONT> <BR><FONT SIZE=2><xsl:param name="searchdn" select="string('' )"/></FONT> <BR><FONT SIZE=2><xsl:param name="replacedn" select="string(' ')"/></FONT> <BR><FONT SIZE=2><xsl:template match="/"></FONT> <BR> <FONT SIZE=2><xsl:if test= "string-length($searchdn) != 0"></FONT> <BR> <FONT SIZE=2><xsl:message>Replacing <xsl:value-of select= "$searchdn"/> with <xsl:value-of select="$replacedn"/ ></xsl:message></FONT></P>
<P> <FONT SIZE=2></xsl:if>< /FONT> <BR> <FONT SIZE=2><xsl:apply -templates select="dsml:dsml/dsml:directory-entries/dsml:entry"/>< /FONT> <BR> <FONT SIZE=2><xsl:text disable-output-escaping="yes">&#xA;</xsl:text></FONT> <BR><FONT SIZE=2></xsl:template></FONT> <BR><FONT SIZE=2><xsl:template match="dsml:entry" name="entry "></FONT> <BR> <FONT SIZE=2><xsl:if test= "string-length($searchdn) != 0"></FONT> <BR> <FONT SIZE=2><xsl:text disable-output-escaping="yes" >&#xA;dn: </xsl:text><xsl:value-of select="concat(substring -before(@(protected),$searchdn),$replacedn,substring-after(@(protected),$searchdn))"/>< /FONT></P>
<P> <FONT SIZE=2></xsl:if>< /FONT> <BR> <FONT SIZE=2><xsl:if test= "string-length($searchdn) = 0"></FONT> <BR> <FONT SIZE=2><xsl:text disable-output-escaping="yes" >&#xA;dn: </xsl:text><xsl:value-of select="@(protected)"/>< /FONT> <BR> <FONT SIZE=2></xsl:if>< /FONT> <BR> <FONT SIZE=2><xsl:for-each select="dsml:objectclass/dsml:oc-value"></FONT> <BR> <FONT SIZE=2><xsl:text disable-output-escaping="yes" >&#xA;objectclass: </xsl:text><xsl:value-of select="text() "/></FONT> <BR> <FONT SIZE=2></xsl:for-each ></FONT> <BR> <FONT SIZE=2><xsl:for-each select="dsml:attr/dsml:value"></FONT> <BR> <FONT SIZE=2><xsl:if test="boolean(string-length(text()) > 0) or boolean(normalize-space(text()) != ' ')"></FONT> <BR> <FONT SIZE=2><xsl :text disable-output-escaping="yes">&#xA;</xsl:text>< ;xsl:value-of select="../@(protected)"/>: <xsl:value-of select=" ;text()"/></FONT></P>
<P> <FONT SIZE=2></xsl:if></FONT> <BR> <FONT SIZE=2></xsl:for-each ></FONT> <BR> <FONT SIZE=2><xsl:text disable-output-escaping="yes">&#xA;</xsl:text></FONT> <BR><FONT SIZE=2> </xsl:template></FONT> <BR><FONT SIZE=2></xsl:stylesheet></FONT> </P>
<P><FONT SIZE=2>Corneil du Plessis</FONT> <BR><FONT SIZE=2>Technical Specialist</FONT> <BR><FONT SIZE=2>Internet Development</FONT> <BR><FONT SIZE=2>Retail Channels</FONT> <BR><FONT SIZE=2>Standard Bank</FONT> <BR><FONT SIZE=2>Direct +27 (11) 636-2210</FONT> <BR><FONT SIZE=2>Mobile +27 (83) 442-9221</FONT> <BR><FONT SIZE=2>ICQ# 66747137</FONT> </P>
<DIV><FONT color=#0000ff>_________________________________________________________________ _________________________________________________________________</FONT></DIV> <DIV>For information about the Standard Bank group visit our web site <<A href="http://www.standardbank.co.za">www.standardbank.co.za</A>><BR><FONT color=#0000ff>_________________________________________________________________ _________________________________________________________________<BR> <BR>< /FONT>Disclaimer and confidentiality note <BR>Everything in this e-mail and any attachments relating to the official business of Standard Bank Group Limited is proprietary to the group. <BR>It is confidential, legally privileged and protected by law. <BR>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. <BR>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, <BR>disclose or use the content in any way.<BR>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.<BR><FONT color=#0000ff>_________________________________________________________________ __________________________________________________________________<BR></FONT>< /DIV> </BODY> </HTML>
|
|
 |