Page 1 of 2

XSLT Warning in XML transformer stage

Posted: Tue Mar 08, 2011 10:56 am
by mctny
Hi ,

I am getting the following warnings in the XML stage,

FeedScript,0: XSLT Warning: The element xsl:sequence is an unknown XSLT element. (, line 9, column 254.)

FeedScript,0: Error: The function 'if' was not found.
expression = 'if ( $SV_BaseOutputFileName ) then $SV_BaseOutputFileName else 'FEED_SCRIPT'' Remaining tokens are: ('if' '(' '$' 'SV_BaseOutputFileName' ')' 'then' '$' 'SV_BaseOutputFileName' 'else' ''FEED_SCRIPT'')

I simplified the original job so that it is as below :

A Flat file input ( one column of string) and an XML stage and then Flat File output ( one column of string).

There is an XSLT transformation in the XML stage


here is my XML input

<?xml version="1.0" encoding="UTF-8" ?><NOTIFICATION><Parameter><BatchID>1451</BatchID><StartDateTime>2010-11-10 11:25</StartDateTime><EndDateTime>2010-11-10 11:42</EndDateTime><ManualDataFile>1</ManualDataFile><UseValidationFailedFile>0</UseValidationFailedFile><FillInMissingObservations>0</FillInMissingObservations><FillInMissingObservationsWithValue>0</FillInMissingObservationsWithValue><ReportOnMissingValues>0</ReportOnMissingValues><PerformPlausibilityCheck>1</PerformPlausibilityCheck><PerformZeroCheck>0</PerformZeroCheck><RejectIfFailedZeroCheck>0</RejectIfFailedZeroCheck><AlwaysOverrideHistory>0</AlwaysOverrideHistory><AlwaysCreateVintage>0</AlwaysCreateVintage><PerformHistoricalUpdatesCheck>1</PerformHistoricalUpdatesCheck><AllowHistoricalUpdates>1</AllowHistoricalUpdates></Parameter><File><FileNotFound>DataFeedPrefix</FileNotFound></File></NOTIFICATION>

here is the first 10 lines of the XSLT tranformation text.


<!--Designed and generated by Altova StyleVision Enterprise Edition 2011 rel. 2 - see http://www.altova.com/stylevision for more information.-->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:altova="http://www.altova.com" xmlns:altovaext="http://www.altova.com/xslt-extensions" xmlns:clitype="clitype" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:iso4217="http://www.xbrl.org/2003/iso4217" xmlns:ix="http://www.xbrl.org/2008/inlineXBRL" xmlns:java="java" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:sps="http://www.altova.com/StyleVision/user-xpath-functions" xmlns:xbrldi="http://xbrl.org/2006/xbrldi" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output version="4.0" method="html" indent="no" encoding="UTF-8" use-character-maps="spaces" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
<xsl:character-map name="spaces">
<xsl:output-character character=" " string="&nbsp;"/>
</xsl:character-map>
<xsl:param name="SV_OutputFormat" select="'HTML'"/>
<xsl:param name="SV_BaseOutputFileName" as="xs:string?">
<xsl:sequence select="for $i in altovaext:get-base-output-uri(), $j in tokenize( $i, &apos;[/\\]&apos; )[last()] return replace( $j, &apos;\.[^\.\s#%;]*$&apos;, &apos;&apos; )" use-when="function-available(&apos;altovaext:get-base-output-uri&apos;)"/>
</xsl:param>

.....
...

Posted: Tue Mar 08, 2011 2:30 pm
by lstsaur
Reading the error message, it looks like even DS 8.5 does not support XSLT 2.0 yet.

Posted: Tue Mar 08, 2011 4:07 pm
by mctny
My colleague said that he tried with XSLT 1.0 and it gave the same errors.

Posted: Tue Mar 08, 2011 6:38 pm
by lstsaur
I don't think there is an xsl:sequence element for XSLT Version 1.0.

Posted: Wed Mar 09, 2011 10:09 am
by mctny
not sure about the differences in xslt version 1 and 2. But You are probably right.

Posted: Wed Mar 09, 2011 11:27 am
by eostic
You may want to consider looking at the new xml Stage in 8.5. It is no longer based on xslt for its processing....providing two possibilities...

a) It left in a "filter" features that allows you to invoke xslt as it ingests the xml. I haven't had a chance to try it, but it is a way to potentially adapt something that in xmlPack2, utilized custom xslt. It's "possible" that this filter supports a higher level of xslt.

b) It can do more. The xml Transformer was often used to do things that were otherwise difficult to do if you needed to shred the nodes and then put them back together (or other complex twisting and turning of elements and attributes). It's possible that you may be able to accomplish your goals with the new Stage.

Ernie

Posted: Wed Mar 09, 2011 11:43 am
by mctny
Hi Ernie,

Yes that's what we are going to do, install the new XML stage, the same thing also recommended by our support provider,

let's see what will happen

thanks

Posted: Thu Mar 10, 2011 6:12 am
by eostic
Describe also what you are trying to do with your xml transformation..........are you reading xml and putting it into something else (flat file, csv, rdbms)? ...reading xml and putting it into "another" xml? ....reading flat files or rdbms and putting all of those into a target xml? That will help with guidance here and also with the new Stage.

Ernie

Posted: Thu Mar 10, 2011 3:49 pm
by mctny
Hi Ernie,

I am trying to read XML and convert it to HTML by using the XSLT tranformations that I will use in the XML stage.

Posted: Thu Mar 10, 2011 4:04 pm
by eostic
Well. Cool. Very interesting. XML tags into HTML tags. How big is the document? Do you have to re-arrange it too? Do you have to Transform any values before you set them up for display purposes?

If it's fairly one:one ("change this main elemenet to the "body" and always make this element bold", etc.), you might be able to do a zap of element names and such into tags using a regular transformer and forget xml stages altogether....

Otherwise, why not just put in a stylesheet entry in the header and be done with it (where the stylesheet has all the rules for display of various elements and attributes)? Is this html being processed by something other than a browser? ...like a legacy app that only knows about html and hasn't been updated to support stylesheets?

...just curious.

Ernie

Posted: Thu Mar 10, 2011 4:33 pm
by mctny
Hi Ernie,

The XML input to the XML transformer is not fixed or constant file, it is produced in the job, to simplify the problem I said that the XML is coming from a flat file to the XML transformer and the output of the transformer is the HTML document.

in the actual job the XML input is produced dynamically in the job and and fed to the XML stages with( there will be 8 of them with different XSLTs in them depending of the value of a job parameter ) and one of the 8 XML stage will be active and produces one HTML document and that will be our body of the email that is going to be sent right after the job finishes.

I did not understand all of your suggestion but Do you think the body of the email can be XML and will be displayed correctly? otherwise how can we dynamically convert the XML to HTML otherwise?

Posted: Thu Mar 10, 2011 4:57 pm
by eostic
I am not a stylesheet expert, but I've seen people write some pretty sophisticated ones. It sounds like you have some dynamically created structures, but in the end, there are "8" varieties?

Again, I have no idea about the email tooling you are trying to support, and am not an expert on stylesheets but I would certainly wonder (and investigate) whether the email tooling receiving this is able to support html rendering including support for stylesheets. That way you would simply have "n" stylesheets (or maybe even one big one that recognizes and looks for the "n" xml varieties and their elements), sent along with the xml, and the email would use them to process and display the xml, just like a browser does.

As noted --- I'm not an expert, but have used some very simple stylesheets with our own ISD technology. By analogy, ISD generates an xml response [using the 8.x REST binding] and sends it down the wire --- along with a stylesheet that is defined for "that" xml content. Somehow (this is where we'd need to speak with a stylesheet expert) the browser knows to utilize the spreadsheet to perform the display. The page looks attractive (I usually use it with a simple stylesheet to create attractive columns for returned data from DataStage), but if you look at the "page source", it's raw xml.

So... who knows...but it would be worth investigating with whoever manages your email clients. Then you could craft one stylesheet, ever, and just sent your xml with a pointer to that stylesheet.... ?

Ernie

Posted: Fri Mar 11, 2011 2:42 pm
by mctny
Hi Ernie,

the tool we use to send the email is the sendmail utility in linux. at the receiving end, the users who will read these emails are using MS outlook.

I am not sure( don't really think) if Outlook can show the XML content even if we send the stylesheet with it.

Do you think it is still possible?, are they any security concern regarding your suggested solution, as the environment is very strict.


Thanks again

Posted: Mon Mar 14, 2011 5:40 am
by eostic
Only an Outlook administrator expert will know. Perhaps they have forums like this one.

Ernie

Posted: Mon Mar 14, 2011 5:36 pm
by vmcburney
Are you using the old XML Pack or the new XML Assembly? I would expect the new XML Assembly for version 8.5 to be more up to date on stylesheet validation than the old XML Pack. XML Pack is a few years old now.