Solved

xslt interacting with other languages

Posted on 2009-07-02
2
194 Views
Last Modified: 2013-11-18
Hello experts!
just a little intro question!

our company is using online software. obviously i dont have an access to any program code.
all i can script how i want is a XSLT code for pdf invoices templates.

the question is can i use some how parts of another script language within xslt.
like PHP or SQL to connect to DB.

i was thinking if i can use some external data at XSLT script (like images) may be it is possible to use something else?

below is part of code where i use external gaphic



<fo:table-cell padding="0pt 0pt 0pt 15pt" border="0" number-rows-spanned="8" vertical-align="top">
<fo:block><!-- list LOGO--><!-- list LOGO--><!-- list LOGO--><!-- list LOGO-->
		<xsl:choose>
		<xsl:when test="@currency='GBP'">
		<fo:external-graphic content-width="136pt" src="url(http://www.mysite/images/logo.gif)"/>
											</xsl:when>
.
.
.
.
.
etc

Open in new window

0
Comment
Question by:nzrubin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 250 total points
ID: 24779921
Hey, you can build extensions to XSLT, inside XSLT
I have an example here of using javascript inside XSLT, using microsoft xml

Each processor has its own extension features
microsft has javascript (and C# in .net)
xalan and saxon have java

so, we need to know which processor you are using
you can find that using:
        <xsl:value-of select="system-property('xsl:vendor')"/>

this would work server based, you can't inlude extension code in browser xslt,
since the extension language and approach is XSLT processor dependent, and you can't control the browser xslt processor

0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 24779923
forgot the example
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
	xmlns:msxsl="urn:schemas-microsoft-com:xslt"
	xmlns:myjs="urn:internal:my-javascript">
	<msxsl:script language="JavaScript" implements-prefix="myjs">
	<![CDATA[
		function GetCurrentDateTime()
		{
		var currentTime = new Date();
		var month = currentTime.getMonth() + 1;
		var day = currentTime.getDate();
		var year = currentTime.getFullYear();
		return(month + "/" + day + "/" + year);
		}
	]]>
	</msxsl:script>
 
<xsl:template match="/">
	<xsl:value-of select="myjs:GetCurrentDateTime()"/>
</xsl:template>
 
</xsl:stylesheet>

Open in new window

0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

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…
It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

751 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