Subjects
Home
Xalan extension functions
Fomatting question serializing DOM with pretty print
xalan with pull parser
Cannot find the declaration
Apache Xalan drop support to run on JRE 1 1 x
Why does Doctype change processing of a document
Node set to XML string via Java extensions in Xalan J: possible?
Templates/Transformers + thread safety???
Problem evaluating xpath with muliple prefix with different namespace
remove an arbitrary attribute from xsl output
Xalan3 XSLT 2 0 XPath 2 0 support?
Problem using compiled translets with Xalan !!
Xalan and jstl 1 1 problem with transform tag
NullPointer in DOM2DTM getLocalName
URIResolvers base parameter with xsltc and cascaded imports
Performance problem for Xalan J on intel dual core
Standard libraries in JAXP?
Serializing a DOM tree to XML file, customize entities replacement
Library Conflict Involving BCEL Library
A question on how users are using <xsl:message >
Kevin Cormier as a new Apache Xalan J committer
Struggling to iterate over tokenized string
Xalan count() trouble
Problem with recursive xpath
Error when switching to java 1 5
document( ' ')
Problem with Xalan2 7 0 transformation
cr/lf options
entity encoded XML
can xalan transform 2 xml using one xslt?
Xalan J JIRA defect review Monday October 16, 2006 from 2:00 to 3:30 pm ED
xsl transform with cdata section elements
xslt parameters not expanded
Weird behavior of XPath evaluate()
How to avoid <xsl:message > instruction prints stylesheet file informations ?
Cannot find SimpleTransform subdirectory after installing Xalan J
recover from document not found exceptions
jdk1 5 and Xalan jar differences?
Performance Issue
Error/Bug adding floating point numbers
XPathAPI: eval exp using nodes with default namespace
modifying xalan to output invalid XML
NullPointerException
mege two separate xml nodes into one
Is this a XALAN document identification bug?
is StylesheetRoot really java io Serializable ?
transform() fails for DOMSource but succeeds for StreamSource
Thoughts on Transformer parameter passing
HELP, Xalan and jstl 1 1 problem with transformer
Problem with XPath namespace axis?
string utils:replace deleting search string if replacement string is an HTML
help with enumeration values pls
xalan 2 5 1 vs 2 7 performance question
How to insert/update in XML document
HTML Serialization and Handling of Ampersands in HREF Attributes
XHTML link tag stripping
SystemId Unknown; Line #24; Column #49; java lang NullPointerException
xpath text() help
Apostrophe problem with xalan 2 7 0
How to set variables in XML document?
Links
Home
Oracle database error code ...
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
substring-after and substring-before

substring-after and substring-before

2003-05-21       - By du Plessis, Corneil C
Reply:     1     2     3     4     5  

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(@(protected),$searchdn),$replacedn,substring-after(@(protected)
n,$searchdn))"/>
  </xsl:if>
  <xsl:if test="string-length($searchdn) = 0">
    <xsl:text disable-output-escaping="yes">&#xA;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">&#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="../@(protected)"/>: <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.
_______________________________________________________________________________
____________________________________________________

<!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>&lt;xsl:stylesheet xmlns:xsl=&quot;<A HREF="http://www.w3.org
/1999/XSL/Transform" TARGET="_blank">http://www.w3.org/1999/XSL/Transform</A>
&quot; xmlns:dsml=&quot;<A HREF="http://www.dsml.org/DSML" TARGET="_blank">http:
//www.dsml.org/DSML</A>&quot; version=&quot;1.0&quot;&gt;</FONT>
<BR><FONT SIZE=2>&lt;xsl:output method=&quot;text&quot; encoding=&quot;UTF-8
&quot; media-type=&quot;text/txt&quot; omit-xml-declaration=&quot;yes&quot; /&gt
;</FONT>
<BR><FONT SIZE=2>&lt;xsl:param name=&quot;searchdn&quot; select=&quot;string(''
)&quot;/&gt;</FONT>
<BR><FONT SIZE=2>&lt;xsl:param name=&quot;replacedn&quot; select=&quot;string('
')&quot;/&gt;</FONT>
<BR><FONT SIZE=2>&lt;xsl:template match=&quot;/&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>&lt;xsl:if test=
&quot;string-length($searchdn) != 0&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; <FONT SIZE=2>&lt;xsl:message&gt;Replacing &lt;xsl:value-of select=
&quot;$searchdn&quot;/&gt; with &lt;xsl:value-of select=&quot;$replacedn&quot;/
&gt;&lt;/xsl:message&gt;</FONT></P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>&lt;/xsl:if&gt;<
/FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>&lt;xsl:apply
-templates select=&quot;dsml:dsml/dsml:directory-entries/dsml:entry&quot;/&gt;<
/FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>&lt;xsl:text
disable-output-escaping=&quot;yes&quot;&gt;&amp;#xA;&lt;/xsl:text&gt;</FONT>
<BR><FONT SIZE=2>&lt;/xsl:template&gt;</FONT>
<BR><FONT SIZE=2>&lt;xsl:template match=&quot;dsml:entry&quot; name=&quot;entry
&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>&lt;xsl:if test=
&quot;string-length($searchdn) != 0&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; <FONT SIZE=2>&lt;xsl:text disable-output-escaping=&quot;yes&quot;
&gt;&amp;#xA;dn: &lt;/xsl:text&gt;&lt;xsl:value-of select=&quot;concat(substring
-before(@(protected),$searchdn),$replacedn,substring-after(@(protected),$searchdn))&quot;/&gt;<
/FONT></P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>&lt;/xsl:if&gt;<
/FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>&lt;xsl:if test=
&quot;string-length($searchdn) = 0&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; <FONT SIZE=2>&lt;xsl:text disable-output-escaping=&quot;yes&quot;
&gt;&amp;#xA;dn: &lt;/xsl:text&gt;&lt;xsl:value-of select=&quot;@(protected)&quot;/&gt;<
/FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>&lt;/xsl:if&gt;<
/FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>&lt;xsl:for-each
select=&quot;dsml:objectclass/dsml:oc-value&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; <FONT SIZE=2>&lt;xsl:text disable-output-escaping=&quot;yes&quot;
&gt;&amp;#xA;objectclass: &lt;/xsl:text&gt;&lt;xsl:value-of select=&quot;text()
&quot;/&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>&lt;/xsl:for-each
&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>&lt;xsl:for-each
select=&quot;dsml:attr/dsml:value&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; <FONT SIZE=2>&lt;xsl:if test=&quot;boolean(string-length(text())
&gt; 0) or boolean(normalize-space(text()) != ' ')&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>&lt;xsl
:text disable-output-escaping=&quot;yes&quot;&gt;&amp;#xA;&lt;/xsl:text&gt;&lt
;xsl:value-of select=&quot;../@(protected)&quot;/&gt;: &lt;xsl:value-of select=&quot
;text()&quot;/&gt;</FONT></P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; <FONT SIZE=2>&lt;/xsl:if&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>&lt;/xsl:for-each
&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>&lt;xsl:text
disable-output-escaping=&quot;yes&quot;&gt;&amp;#xA;&lt;/xsl:text&gt;</FONT>
<BR><FONT SIZE=2>&nbsp;&lt;/xsl:template&gt;</FONT>
<BR><FONT SIZE=2>&lt;/xsl:stylesheet&gt;</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 &lt;<A
href="http://www.standardbank.co.za">www.standardbank.co.za</A>&gt;<BR><FONT
color=#0000ff>_________________________________________________________________
_________________________________________________________________<BR>&nbsp;<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&nbsp; 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>