Solved

cut off part of the strintg XSL FO

Posted on 2009-07-01
7
744 Views
Last Modified: 2013-11-18
Hello Guys

is it possible to get rid of part of the string (do not display it at the pdf) in xsl fo file?

 for example here i need to cut off (in THB) :
some company name (in THB)
another company name (in THB)
etc....

if it was just one off string i could do:

<xsl:if test="@companyName='some company name (in THB)'">
some company name
</xsl:if>

however the company name will be always different! so i need to cut the part of string (in THB) only off!

is it possible to do at XSL FO?

<xsl:if test="@companyName='some company name (in THB)'">

some company name

</xsl:if>

Open in new window

0
Comment
Question by:nzrubin
  • 4
  • 3
7 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 24761251
something like this will do that
    <xsl:value-of select="substring-before(., '(in')"/>
    <xsl:value-of select="substring-after(substring-after(., '(in'), ')')"/>

If you have multiple unlknown company strings in one elemen, you will need some recursive processing, let me know if that is the case

If you can use XSLT2.0 (highly recommended when you need string processing) tell me too
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24761261
Look how elegant a XSLT2 solution is for multiple companies
    <xsl:analyze-string select="." regex="\(\s*in[^\)]*\)">

        <xsl:non-matching-substring>

            <xsl:value-of select="."></xsl:value-of>

        </xsl:non-matching-substring>

    </xsl:analyze-string>

Open in new window

0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24761268
Please note that allthough your FO processor might not support XSLT2,
XSL-FO processors don't need to do the XSLT stuff themselves.
In my XSL-FO projects I never use the built in XSLT processor,
I always use Saxon9B for the XSLT part, so I can use XSLT2
and I only use the FO processor for dealing with the FO to PDF rendering
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 4

Author Closing Comment

by:nzrubin
ID: 31598973
hi Gertone: it works!
for some reason i couldnt find this info in the internet...
in the close future ill need to ask some more questions.  Will you monitor? how can you first check out the questions?
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24767774
In his grading comment (not visible to all) the asker posts
> in the close future ill need to ask some more questions. Will you monitor? how can you first check out the questions?
Here is my answer:

All XSLT questions are prompted via email.
Anyone interested in receiving a notification for XSLT questions gets an email if you post a question.
I read them and many other experts do too.
This way it is likely that you get an answer to your questions really fast

cheers
0
 
LVL 4

Author Comment

by:nzrubin
ID: 24768951
just found out that it cuts fine, but if there is no character in the string that i indicate  to cut before ... the string just displays nothing!

for example i want to display all string in front of  (  
but if no bracket in the string --- the string is not displays at all!  
0
 
LVL 4

Author Comment

by:nzrubin
ID: 24769224
found work around it



<xsl:choose>

											<xsl:when test="substring-before(@billingCompany,' (')=''">

												<xsl:value-of select="@billingCompany"/>

											</xsl:when>

											

											<xsl:otherwise>

												<xsl:value-of select="substring-before(@billingCompany,' (')"/>												

											</xsl:otherwise>

										</xsl:choose>

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now