Solved

xslt interacting with other languages

Posted on 2009-07-02
2
195 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
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:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

632 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