|
View:
New views
13 Messages
—
Rating Filter:
Alert me
|
|
|
not able to reassing value to saxon:assignable variablesHi there,
style sheet as below, <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory" xmlns:java="http://saxon.sf.net/java-type" xmlns:saxon="http://saxon.sf.net/" extension-element-prefixes="saxon" exclude-result-prefixes="java" version="1.0"> <xsl:variable name="count" select="0" saxon:assignable="yes" /> <xsl:template name="main" match="/"> <xsl:variable name="err_doc"> <xsl:call-template name="validate_doc" /> </xsl:variable> <!--<xsl:call-template name="validate_doc" /> --> <test> <xsl:copy-of select="$count" /> </test> </xsl:template> <xsl:template name="validate_doc"> <saxon:assign name="count" select="$count+1" /> <xsl:call-template name="applyTemplateForError" /> </xsl:template> <xsl:template name="applyTemplateForError"> <saxon:assign name="count" select="$count+1" /> </xsl:template> </xsl:stylesheet> When i execute i get the following result count value as 0. Where as i am expecting count value as 2. <test xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory">0</test> count variable is global, hence the value should be 2, What am i doing wrong here? , instead of <xsl:variable name="err_doc"> <xsl:call-template name="validate_doc" /> </xsl:variable> if I execute <xsl:call-template name="validate_doc" /> , It works fine , Any input on this? Regards Brijesh N K |
|
|
Re: not able to reassing value to saxon:assignable variablesA variable that is never used is never evaluated: Saxon optimizes it out. saxon:assign is not a good fit with a functional programming language: it can occasionally be very useful, but is best avoided in general. This is clearly a dummy test stylesheet, so it's not possible to give advice on how to rewrite it, but there is usually a better way of designing the application. If you must use saxon:assign, then for predictable results use it in a context where xsl:result-document would be permitted: that is, in a sequence constructor that is generating content destined for the primary output file. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: brijesh [mailto:brijeshnk@...] > Sent: 30 October 2009 11:34 > To: saxon-help@... > Subject: [saxon] not able to reassing value to > saxon:assignable variables > > > Hi there, > > style sheet as below, > > > <?xml version="1.0" encoding="utf-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory" > xmlns:java="http://saxon.sf.net/java-type" > xmlns:saxon="http://saxon.sf.net/" > extension-element-prefixes="saxon" > exclude-result-prefixes="java" version="1.0"> > > <xsl:variable name="count" select="0" saxon:assignable="yes" /> > > <xsl:template name="main" match="/"> > > > <xsl:variable name="err_doc"> > <xsl:call-template name="validate_doc" /> > </xsl:variable> > > > <!--<xsl:call-template name="validate_doc" /> --> > > <test> > <xsl:copy-of select="$count" /> > </test> > > </xsl:template> > > <xsl:template name="validate_doc"> > <saxon:assign name="count" select="$count+1" /> > > <xsl:call-template name="applyTemplateForError" /> > </xsl:template> > > <xsl:template name="applyTemplateForError"> > <saxon:assign name="count" select="$count+1" /> > </xsl:template> > </xsl:stylesheet> > > When i execute i get the following result count value as 0. > Where as i am expecting count value as 2. > > <test xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory">0</test> > > count variable is global, hence the value should be 2, > > What am i doing wrong here? , instead of > > <xsl:variable name="err_doc"> > <xsl:call-template name="validate_doc" /> > </xsl:variable> > > if I execute > > <xsl:call-template name="validate_doc" /> , > > It works fine , Any input on this? > > > > > Regards > > Brijesh N K > > -- > View this message in context: > http://old.nabble.com/not-able-to-reassing-value-to-saxon%3Aas > signable-variables-tp26128538p26128538.html > Sent from the saxon-help mailing list archive at Nabble.com. > > > -------------------------------------------------------------- > ---------------- > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. > Jumpstart your > developing skills, take BlackBerry mobile applications to > market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > saxon-help mailing list archived at http://saxon.markmail.org/ > saxon-help@... > https://lists.sourceforge.net/lists/listinfo/saxon-help ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: not able to reassing value to saxon:assignable variablesHi ,
thanks a lot Michael for the reponse. I am new to writing xslt , But my thoughts allways go with procedureal programming due to my Java backround. Below is complete xslt, I am basically try to write a validation xslt-(though schema is better way to achieve xml validation , i am forced to write xslt way due to other tech constraints) <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory" xmlns:rfc="urn:sap-com:document:sap:rfc:functions" xmlns:not="http://www.ekaplus.com/NotifyEvent/" xmlns:java="http://saxon.sf.net/java-type" xmlns:saxon="http://saxon.sf.net/" extension-element-prefixes="saxon" exclude-result-prefixes="java" version="1.0"> <xsl:variable name="error_count" select="0" saxon:assignable="yes" /> <xsl:template name="main" match="/"> <xsl:variable name="err_doc"> <xsl:call-template name="validate_doc" /> </xsl:variable> <xsl:choose> <xsl:when test="$error_count > 1"> <xsl:copy-of select="$err_doc" /> </xsl:when> <xsl:otherwise> <xsl:copy-of select="." /> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="validate_doc"> <xsl:element name="GenericDocument" namespace="com.ekaplus.commons.document"> <xsl:attribute name="document_Id"> <xsl:value-of select="'ERROR_DOC'" /> </xsl:attribute> <xsl:attribute name="description"> <xsl:value-of select="'Error document after validation'" /> </xsl:attribute> <xsl:attribute name="name"> <xsl:value-of select="'Error response document'" /> </xsl:attribute> <xsl:attribute name="created_date"> <xsl:value-of select="'2009-10-26'" /> </xsl:attribute> <xsl:element name="PropertyData" namespace="com.ekaplus.commons.document"> <xsl:element name="PropertyData" namespace="com.ekaplus.commons.document"> <xsl:attribute name="pkey"> <xsl:value-of select="'Status'" /> </xsl:attribute> <xsl:attribute name="pvalue"> <xsl:value-of select="'FAILED'" /> </xsl:attribute> <xsl:call-template name="applyTemplateForError" /> </xsl:element> </xsl:element> </xsl:element> </xsl:template> <xsl:template name="applyTemplateForError"> <xsl:variable name="ret"> <xsl:if test="rfc:Z_BAPI_BANK_CUSTOMER_VENDOR/INPUT_BUPA/NAME_1 = ''"> <xsl:element name="PropertyData" namespace="com.ekaplus.commons.document"> <xsl:attribute name="pkey"> <xsl:value-of select="'Message'" /> </xsl:attribute> <xsl:attribute name="pvalue"> <xsl:value-of select="'ERR_CP_001'" /> </xsl:attribute> <xsl:element name="PropertyData" namespace="com.ekaplus.commons.document"> <xsl:attribute name="pkey"> <xsl:value-of select="'MessageDescr'" /> </xsl:attribute> <xsl:attribute name="pvalue"> <xsl:value-of select="'NAME_1 is missing in source document'" /> </xsl:attribute> </xsl:element> </xsl:element> <saxon:assign name="error_count" select="$error_count + 1" /> </xsl:if> <xsl:if test="rfc:Z_BAPI_BANK_CUSTOMER_VENDOR/INPUT_BUPA/SORT_FIELD = ''"> <xsl:element name="com:PropertyData"> <xsl:attribute name="pkey"> <xsl:value-of select="'Message'" /> </xsl:attribute> <xsl:attribute name="pvalue"> <xsl:value-of select="'ERR_CP_002'" /> </xsl:attribute> <xsl:element name="com:PropertyData"> <xsl:attribute name="pkey"> <xsl:value-of select="'MessageDescr'" /> </xsl:attribute> <xsl:attribute name="pvalue"> <xsl:value-of select="'SORT_FIELD is missing in source document'" /> </xsl:attribute> </xsl:element> </xsl:element> <saxon:assign name="errorDoc" select="'true'" /> </xsl:if> </xsl:variable> <xsl:copy-of select="$ret" /> </xsl:template> </xsl:stylesheet> The following is my sample input xml document <rfc:Z_BAPI_BANK_CUSTOMER_VENDOR xmlns:rfc="urn:sap-com:document:sap:rfc:functions" xmlns:com="com.ekaplus.commons.document" xmlns:not="http://www.ekaplus.com/NotifyEvent/" xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory"> <INPUT_BUPA> <ACCOUNT_GROUP>ZEKA</ACCOUNT_GROUP> <BP_NR>1000000007</BP_NR> <COMPANY_CODE>3500</COMPANY_CODE> <REF_BP_NR>3500</REF_BP_NR> <INDUSTRY>CH</INDUSTRY> <NAME_1></NAME_1> <SORT_FIELD/> <HOUSE_STREET>12/3-4 Maple Street</HOUSE_STREET> <CITY>Brisbane</CITY> <COUNTRY_KEY>AU</COUNTRY_KEY> <POSTAL_CODE>123-4567</POSTAL_CODE> <REGION/> <FIRST_TELEPHONE_NR>12345678</FIRST_TELEPHONE_NR> <FAX_NR>87654321</FAX_NR> <INTERNET_MAIL>test1@test1.com</INTERNET_MAIL> <VAT_NR>vat</VAT_NR> <PAYMENT_METHODS/> <BANKING> <item> <COUNTRY_KEY>AU</COUNTRY_KEY> <BANK_KEY/> <BANK_NAME>HDFC</BANK_NAME> <REGION/> <HOUSE_STREET>City market</HOUSE_STREET> <CITY>Brisbane</CITY> <BRANCH/> <SWIFT/> <BANK_ACC_NR>1234</BANK_ACC_NR> <BANK_ACC_HOLDER>HDFC_Benf_1</BANK_ACC_HOLDER> <BANK_TYPE>HDFC_User1</BANK_TYPE> <IBAN></IBAN> </item> </BANKING> </INPUT_BUPA> </rfc:Z_BAPI_BANK_CUSTOMER_VENDOR> tamplate will see the values in specific element, if the values are not found , template would be sending a document with error details created by template , but the document is valid , tamplate needs send the same source document back. can u please suggest better way of achiving this , without using saxon:assignable variable? Regards Brijesh N K
|
|
|
Re: not able to reassing value to saxon:assignable variablesI don't think you need saxon:assign here. As far as I can see, you are constructing an error document containing details of errors, and binding this to a variable, and you should then be able to determine whether there were any errors by looking inside this document and seeing if it is empty. Incidentally, XSLT code has a reputation for being verbose, which isn't helped when people choose to write > <xsl:element name="GenericDocument" > namespace="com.ekaplus.commons.document"> > <xsl:attribute name="document_Id"> > <xsl:value-of select="'ERROR_DOC'" /> > </xsl:attribute> > > <xsl:attribute name="description"> > <xsl:value-of > select="'Error document after validation'" /> > </xsl:attribute> > <xsl:attribute name="name"> > <xsl:value-of select="'Error response document'" /> > </xsl:attribute> > <xsl:attribute name="created_date"> > <xsl:value-of select="'2009-10-26'" /> > </xsl:attribute> > when they could have written: <e:GenericDocument documentId="ERROR_DOC" description="Error document after validation" name="Error response document" created_date="2009-10-26"> Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: brijesh [mailto:brijeshnk@...] > Sent: 02 November 2009 11:29 > To: saxon-help@... > Subject: Re: [saxon] not able to reassing value to > saxon:assignable variables > > > Hi , > > thanks a lot Michael for the reponse. I am new to writing > xslt , But my thoughts allways go with procedureal > programming due to my Java backround. > > Below is complete xslt, I am basically try to write a > validation xslt-(though schema is better way to achieve xml > validation , i am forced to write xslt way due to other tech > constraints) > > <?xml version="1.0" encoding="utf-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory" > xmlns:rfc="urn:sap-com:document:sap:rfc:functions" > xmlns:not="http://www.ekaplus.com/NotifyEvent/" > xmlns:java="http://saxon.sf.net/java-type" > xmlns:saxon="http://saxon.sf.net/" > extension-element-prefixes="saxon" > exclude-result-prefixes="java" version="1.0"> > > <xsl:variable name="error_count" select="0" > saxon:assignable="yes" /> > > > <xsl:template name="main" match="/"> > > <xsl:variable name="err_doc"> > <xsl:call-template name="validate_doc" /> > </xsl:variable> > > > <xsl:choose> > <xsl:when test="$error_count > 1"> > <xsl:copy-of select="$err_doc" /> > </xsl:when> > <xsl:otherwise> > <xsl:copy-of select="." /> > </xsl:otherwise> > </xsl:choose> > > > </xsl:template> > > <xsl:template name="validate_doc"> > > <xsl:element name="GenericDocument" > namespace="com.ekaplus.commons.document"> > <xsl:attribute name="document_Id"> > <xsl:value-of select="'ERROR_DOC'" /> > </xsl:attribute> > > <xsl:attribute name="description"> > <xsl:value-of > select="'Error document > after validation'" /> > </xsl:attribute> > > > <xsl:attribute name="name"> > <xsl:value-of select="'Error > response document'" /> > </xsl:attribute> > <xsl:attribute name="created_date"> > <xsl:value-of select="'2009-10-26'" /> > </xsl:attribute> > > > <xsl:element name="PropertyData" > > namespace="com.ekaplus.commons.document"> > <xsl:element name="PropertyData" > > namespace="com.ekaplus.commons.document"> > <xsl:attribute name="pkey"> > <xsl:value-of > select="'Status'" /> > </xsl:attribute> > <xsl:attribute name="pvalue"> > <xsl:value-of > select="'FAILED'" /> > </xsl:attribute> > > <xsl:call-template > name="applyTemplateForError" /> > </xsl:element> > </xsl:element> > </xsl:element> > </xsl:template> > > <xsl:template name="applyTemplateForError"> > > <xsl:variable name="ret"> > > <xsl:if > > test="rfc:Z_BAPI_BANK_CUSTOMER_VENDOR/INPUT_BUPA/NAME_1 = ''"> > > <xsl:element name="PropertyData" > > namespace="com.ekaplus.commons.document"> > <xsl:attribute name="pkey"> > > <xsl:value-of select="'Message'" /> > </xsl:attribute> > <xsl:attribute name="pvalue"> > > <xsl:value-of select="'ERR_CP_001'" /> > </xsl:attribute> > <xsl:element name="PropertyData" > > namespace="com.ekaplus.commons.document"> > <xsl:attribute > name="pkey"> > > <xsl:value-of select="'MessageDescr'" /> > </xsl:attribute> > <xsl:attribute > name="pvalue"> > > <xsl:value-of > > select="'NAME_1 is missing in source document'" /> > </xsl:attribute> > </xsl:element> > </xsl:element> > <saxon:assign name="error_count" > select="$error_count + 1" /> > </xsl:if> > > <xsl:if > > test="rfc:Z_BAPI_BANK_CUSTOMER_VENDOR/INPUT_BUPA/SORT_FIELD = ''"> > > <xsl:element name="com:PropertyData"> > <xsl:attribute name="pkey"> > <xsl:value-of > select="'Message'" /> > </xsl:attribute> > <xsl:attribute name="pvalue"> > <xsl:value-of > select="'ERR_CP_002'" /> > </xsl:attribute> > <xsl:element > name="com:PropertyData"> > <xsl:attribute > name="pkey"> > <xsl:value-of > select="'MessageDescr'" /> > </xsl:attribute> > <xsl:attribute > name="pvalue"> > <xsl:value-of > > select="'SORT_FIELD is missing in source document'" /> > </xsl:attribute> > </xsl:element> > </xsl:element> > <saxon:assign name="errorDoc" > select="'true'" /> > </xsl:if> > > </xsl:variable> > <xsl:copy-of select="$ret" /> > </xsl:template> > </xsl:stylesheet> > > The following is my sample input xml document > > <rfc:Z_BAPI_BANK_CUSTOMER_VENDOR > xmlns:rfc="urn:sap-com:document:sap:rfc:functions" > xmlns:com="com.ekaplus.commons.document" > xmlns:not="http://www.ekaplus.com/NotifyEvent/" > xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory"> > <INPUT_BUPA> > <ACCOUNT_GROUP>ZEKA</ACCOUNT_GROUP> > <BP_NR>1000000007</BP_NR> > <COMPANY_CODE>3500</COMPANY_CODE> > <REF_BP_NR>3500</REF_BP_NR> > <INDUSTRY>CH</INDUSTRY> > <NAME_1></NAME_1> > <SORT_FIELD/> > <HOUSE_STREET>12/3-4 Maple Street</HOUSE_STREET> > <CITY>Brisbane</CITY> > <COUNTRY_KEY>AU</COUNTRY_KEY> > <POSTAL_CODE>123-4567</POSTAL_CODE> > <REGION/> > <FIRST_TELEPHONE_NR>12345678</FIRST_TELEPHONE_NR> > <FAX_NR>87654321</FAX_NR> > <INTERNET_MAIL>test1@...</INTERNET_MAIL> > <VAT_NR>vat</VAT_NR> > <PAYMENT_METHODS/> > <BANKING> > <item> > <COUNTRY_KEY>AU</COUNTRY_KEY> > <BANK_KEY/> > <BANK_NAME>HDFC</BANK_NAME> > <REGION/> > <HOUSE_STREET>City market</HOUSE_STREET> > <CITY>Brisbane</CITY> > <BRANCH/> > <SWIFT/> > <BANK_ACC_NR>1234</BANK_ACC_NR> > > <BANK_ACC_HOLDER>HDFC_Benf_1</BANK_ACC_HOLDER> > <BANK_TYPE>HDFC_User1</BANK_TYPE> > <IBAN></IBAN> > </item> > </BANKING> > </INPUT_BUPA> > </rfc:Z_BAPI_BANK_CUSTOMER_VENDOR> > > tamplate will see the values in specific element, if the > values are not found , template would be sending a document > with error details created by template , but the document is > valid , tamplate needs send the same source document back. > > can u please suggest better way of achiving this , without > using saxon:assignable variable? > > > Regards > Brijesh N K > > > > > > > > Michael Kay wrote: > > > > > > A variable that is never used is never evaluated: Saxon > optimizes it out. > > > > saxon:assign is not a good fit with a functional > programming language: > > it can occasionally be very useful, but is best avoided in general. > > This is clearly a dummy test stylesheet, so it's not > possible to give > > advice on how to rewrite it, but there is usually a better way of > > designing the application. If you must use saxon:assign, then for > > predictable results use it in a context where xsl:result-document > > would be permitted: that is, in a sequence constructor that is > > generating content destined for the primary output file. > > > > Regards, > > > > Michael Kay > > http://www.saxonica.com/ > > http://twitter.com/michaelhkay > > > > > > > >> -----Original Message----- > >> From: brijesh [mailto:brijeshnk@...] > >> Sent: 30 October 2009 11:34 > >> To: saxon-help@... > >> Subject: [saxon] not able to reassing value to saxon:assignable > >> variables > >> > >> > >> Hi there, > >> > >> style sheet as below, > >> > >> > >> <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet > >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > >> xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory" > >> xmlns:java="http://saxon.sf.net/java-type" > >> xmlns:saxon="http://saxon.sf.net/" > >> extension-element-prefixes="saxon" > >> exclude-result-prefixes="java" version="1.0"> > >> > >> <xsl:variable name="count" select="0" saxon:assignable="yes" /> > >> > >> <xsl:template name="main" match="/"> > >> > >> > >> <xsl:variable name="err_doc"> > >> <xsl:call-template name="validate_doc" /> > >> </xsl:variable> > >> > >> > >> <!--<xsl:call-template name="validate_doc" /> --> > >> > >> <test> > >> <xsl:copy-of select="$count" /> > >> </test> > >> > >> </xsl:template> > >> > >> <xsl:template name="validate_doc"> > >> <saxon:assign name="count" select="$count+1" /> > >> > >> <xsl:call-template name="applyTemplateForError" /> > >> </xsl:template> > >> > >> <xsl:template name="applyTemplateForError"> > >> <saxon:assign name="count" select="$count+1" /> > >> </xsl:template> > >> </xsl:stylesheet> > >> > >> When i execute i get the following result count value as 0. > >> Where as i am expecting count value as 2. > >> > >> <test xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory">0</test> > >> > >> count variable is global, hence the value should be 2, > >> > >> What am i doing wrong here? , instead of > >> > >> <xsl:variable name="err_doc"> > >> <xsl:call-template name="validate_doc" /> > >> </xsl:variable> > >> > >> if I execute > >> > >> <xsl:call-template name="validate_doc" /> , > >> > >> It works fine , Any input on this? > >> > >> > >> > >> > >> Regards > >> > >> Brijesh N K > >> > >> -- > >> View this message in context: > >> http://old.nabble.com/not-able-to-reassing-value-to-saxon%3Aas > >> signable-variables-tp26128538p26128538.html > >> Sent from the saxon-help mailing list archive at Nabble.com. > >> > >> > >> -------------------------------------------------------------- > >> ---------------- > >> Come build with us! The BlackBerry(R) Developer Conference > in SF, CA > >> is the only developer event you need to attend this year. > >> Jumpstart your > >> developing skills, take BlackBerry mobile applications to > market and > >> stay ahead of the curve. Join us from November 9 - 12, > 2009. Register > >> now! > >> http://p.sf.net/sfu/devconference > >> _______________________________________________ > >> saxon-help mailing list archived at http://saxon.markmail.org/ > >> saxon-help@... > >> https://lists.sourceforge.net/lists/listinfo/saxon-help > > > > > > > ---------------------------------------------------------------------- > > -------- Come build with us! The BlackBerry(R) Developer > Conference in > > SF, CA is the only developer event you need to attend this year. > > Jumpstart your developing skills, take BlackBerry mobile > applications > > to market and stay ahead of the curve. Join us from > November 9 - 12, > > 2009. Register now! > > http://p.sf.net/sfu/devconference > > _______________________________________________ > > saxon-help mailing list archived at http://saxon.markmail.org/ > > saxon-help@... > > https://lists.sourceforge.net/lists/listinfo/saxon-help > > > > > > -- > View this message in context: > http://old.nabble.com/not-able-to-reassing-value-to-saxon%3Aas > signable-variables-tp26128538p26156681.html > Sent from the saxon-help mailing list archive at Nabble.com. > > > -------------------------------------------------------------- > ---------------- > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. > Jumpstart your > developing skills, take BlackBerry mobile applications to > market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > saxon-help mailing list archived at http://saxon.markmail.org/ > saxon-help@... > https://lists.sourceforge.net/lists/listinfo/saxon-help ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: not able to reassing value to saxon:assignable variablesThanks a lot Michael for the response,
I have modified the style as follows , <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:com="com.ekaplus.commons.document" xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory" xmlns:rfc="urn:sap-com:document:sap:rfc:functions" xmlns:not="http://www.ekaplus.com/NotifyEvent/" xmlns:java="http://saxon.sf.net/java-type" xmlns:saxon="http://saxon.sf.net/" extension-element-prefixes="saxon" exclude-result-prefixes="java,com" version="1.0"> <xsl:template name="main" match="/"> <xsl:variable name="err_doc"> - Show quoted text - <xsl:element name="GenericDocument" namespace="com.ekaplus.commons.document"> <xsl:attribute name="document_Id"> <xsl:value-of select="'ERROR_DOC'"/> </xsl:attribute> <xsl:attribute name="description"> <xsl:value-of select="'Error document after validation'"/> </xsl:attribute> <xsl:attribute name="name"> <xsl:value-of select="'Error response document'"/> </xsl:attribute> <xsl:attribute name="created_date"> <xsl:value-of select="'2009-10-26'"/> </xsl:attribute> <xsl:element name="PropertyData" namespace="com.ekaplus.commons.document"> <xsl:element name="PropertyData" namespace="com.ekaplus.commons.document"> <xsl:attribute name="pkey"> <xsl:value-of select="'Status'"/> </xsl:attribute> <xsl:attribute name="pvalue"> <xsl:value-of select="'FAILED'"/> </xsl:attribute> <xsl:call-template name="applyTemplateForError"/> </xsl:element> </xsl:element> </xsl:element> </xsl:variable> <xsl:copy-of select="$err_doc"/> </xsl:template> <xsl:template name="applyTemplateForError"> <xsl:variable name="ret"> <xsl:if test="rfc:Z_BAPI_BANK_CUSTOMER_VENDOR/INPUT_BUPA/NAME_1 = ''"> <xsl:element name="PropertyData" namespace="com.ekaplus.commons.document"> <xsl:attribute name="pkey"> <xsl:value-of select="'Message'"/> </xsl:attribute> <xsl:attribute name="pvalue"> <xsl:value-of select="'ERR_CP_001'"/> </xsl:attribute> <xsl:element name="PropertyData" namespace="com.ekaplus.commons.document"> <xsl:attribute name="pkey"> <xsl:value-of select="'MessageDescr'"/> </xsl:attribute> <xsl:attribute name="pvalue"> <xsl:value-of select="'NAME_1 is missing in source document'"/> </xsl:attribute> </xsl:element> </xsl:element> </xsl:if> </xsl:variable> <xsl:copy-of select="$ret"/> </xsl:template> </xsl:stylesheet> When I print the content of err_doc variable , I get the documetn without namespace declaration(though namespace prefix(com) is added without declarion) , as follows <com:GenericDocument document_Id="ERROR_DOC" description="Error document after validation" name="Error response document" created_date="2009-10-26"><com:PropertyData><com:PropertyData pkey="Status" pvalue="FAILED"><com:PropertyData pkey="Message" pvalue="ERR_CP_001"><com:PropertyData pkey="MessageDescr" pvalue="NAME_1 is missing in source document"/></com:PropertyData></com:PropertyData></com:PropertyData></com:GenericDocument> can u please suggest , whats wrong here , how do i correct this issue. I am afraid , this is more of xslt specific question than saxon , i apologise for that thanks for the help Brijesh N K
|
|
|
Re: not able to reassing value to saxon:assignable variables> When I print the content of err_doc variable , I get the documetn without > namespace declaration(though namespace prefix(com) is added without > declarion) , as follows unless you use disable-output-escaping or character maps you should never get output that is not namespace well formed unless there is a bug what do you mean by "print" is the com prefix already in scope in the output document for example? you still appear to be using saxon:assign and very verbose style which makes it very hard to read the stylesheet. <xsl:variable name="err_doc"> - Show quoted text - <xsl:element name="GenericDocument" namespace="com.ekaplus.commons.document"> <xsl:attribute name="document_Id"> <xsl:value-of select="'ERROR_DOC'"/> </xsl:attribute> <xsl:attribute name="description"> <xsl:value-of select="'Error document after validation'"/> </xsl:attribute> <xsl:attribute name="name"> <xsl:value-of select="'Error response document'"/> </xsl:attribute> <xsl:attribute name="created_date"> <xsl:value-of select="'2009-10-26'"/> </xsl:attribute> <xsl:element name="PropertyData" namespace="com.ekaplus.commons.document"> <xsl:element name="PropertyData" namespace="com.ekaplus.commons.document"> <xsl:attribute name="pkey"> <xsl:value-of select="'Status'"/> </xsl:attribute> <xsl:attribute name="pvalue"> <xsl:value-of select="'FAILED'"/> </xsl:attribute> <xsl:call-template name="applyTemplateForError"/> </xsl:element> </xsl:element> </xsl:element> </xsl:variable> could be <xsl:variable name="err_doc" xmlns="com.ekaplus.commons.document"> - Show quoted text - <GenericDocument document_Id="ERROR_DOC description="Error document after validation" name="Error response document"/ created_date"2009-10-26"> <PropertyData> <PropertyData pkey="Status" pvalue="FAILED"> <xsl:call-template name="applyTemplateForError"/> </PropertyData> </PropertyData> </GenericDocument> </xsl:variable> which is rather easier to read/debug. > I am afraid , this is more of xslt specific question than saxon , i > apologise for that xsl-list is better for general xsl-questions. David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________ ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: not able to reassing value to saxon:assignable variablesDavid, thanks for the response ,
below is output document after transformation ,
you can see that com prefix is added(<com:GenericDocument) , but defenition is missing , but style sheet has defenition as
xmlns:com="com.ekaplus.commons.document"
output document:
<com:GenericDocument document_Id="ERROR_DOC" description="Error document after validation" name="Error response document" created_date="2009-10-26"><com:PropertyData><com:PropertyData pkey="Status" pvalue="FAILED"><com:PropertyData pkey="Message" pvalue="ERR_CP_001"><com:PropertyData pkey="MessageDescr" pvalue="NAME_1 is missing in source document"/></com:PropertyData></com:PropertyData></com:PropertyData></com:GenericDocument>
Regards
Brijesh N K
On Tue, Nov 3, 2009 at 12:43 PM, David Carlisle <davidc@...> wrote:
------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: not able to reassing value to saxon:assignable variablesI can't reproduce the problem from the information given.
I fixed the stylesheet by changing exclude-result-prefixes="java,com" to exclude-result-prefixes="java com" to avoid a compile-time error, and then ran with a dummy input document. The output was: <?xml version="1.0" encoding="UTF-8"?> <GenericDocument xmlns="com.ekaplus.commons.document" document_Id="ERROR_DOC" description="Error document after validation" name="Error response document" created_date="2009-10-26"> <PropertyData> <PropertyData pkey="Status" pvalue="FAILED"/> </PropertyData> </GenericDocument> Please could you give me a complete repro: source document, stylesheet, information on how to run it, versions of Saxon and Java that you used, and output that you got. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: brijesh [mailto:brijeshnk@...] > Sent: 03 November 2009 05:26 > To: saxon-help@... > Subject: Re: [saxon] not able to reassing value to > saxon:assignable variables > > > Thanks a lot Michael for the response, > > I have modified the style as follows , > > <?xml version="1.0" encoding="utf-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > xmlns:com="com.ekaplus.commons.document" > > xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory" > xmlns:rfc="urn:sap-com:document:sap:rfc:functions" > xmlns:not="http://www.ekaplus.com/NotifyEvent/" > > xmlns:java="http://saxon.sf.net/java-type" > xmlns:saxon="http://saxon.sf.net/" extension-element-prefixes="saxon" > exclude-result-prefixes="java,com" version="1.0"> > > > > <xsl:template name="main" match="/"> > > <xsl:variable name="err_doc"> > > > - Show quoted text - > <xsl:element name="GenericDocument" > namespace="com.ekaplus.commons.document"> > <xsl:attribute name="document_Id"> > <xsl:value-of select="'ERROR_DOC'"/> > </xsl:attribute> > > <xsl:attribute name="description"> > <xsl:value-of select="'Error document > after validation'"/> > </xsl:attribute> > > > <xsl:attribute name="name"> > <xsl:value-of select="'Error response document'"/> > </xsl:attribute> > <xsl:attribute name="created_date"> > <xsl:value-of select="'2009-10-26'"/> > </xsl:attribute> > > > <xsl:element name="PropertyData" > namespace="com.ekaplus.commons.document"> > <xsl:element name="PropertyData" > namespace="com.ekaplus.commons.document"> > <xsl:attribute name="pkey"> > <xsl:value-of select="'Status'"/> > </xsl:attribute> > <xsl:attribute name="pvalue"> > <xsl:value-of select="'FAILED'"/> > </xsl:attribute> > > > <xsl:call-template > name="applyTemplateForError"/> > </xsl:element> > </xsl:element> > </xsl:element> > > </xsl:variable> > > <xsl:copy-of select="$err_doc"/> > > > > </xsl:template> > > <xsl:template name="applyTemplateForError"> > > > <xsl:variable name="ret"> > > <xsl:if > test="rfc:Z_BAPI_BANK_CUSTOMER_VENDOR/INPUT_BUPA/NAME_1 > = ''"> > > <xsl:element name="PropertyData" > namespace="com.ekaplus.commons.document"> > <xsl:attribute name="pkey"> > <xsl:value-of select="'Message'"/> > </xsl:attribute> > <xsl:attribute name="pvalue"> > <xsl:value-of select="'ERR_CP_001'"/> > </xsl:attribute> > <xsl:element name="PropertyData" > namespace="com.ekaplus.commons.document"> > <xsl:attribute name="pkey"> > <xsl:value-of select="'MessageDescr'"/> > </xsl:attribute> > <xsl:attribute name="pvalue"> > <xsl:value-of select="'NAME_1 is > missing in source document'"/> > </xsl:attribute> > </xsl:element> > </xsl:element> > > > </xsl:if> > > > </xsl:variable> > <xsl:copy-of select="$ret"/> > </xsl:template> > </xsl:stylesheet> > > > When I print the content of err_doc variable , I get the > documetn without namespace declaration(though namespace > prefix(com) is added without > declarion) , as follows > > <com:GenericDocument document_Id="ERROR_DOC" > description="Error document after validation" name="Error > response document" > created_date="2009-10-26"><com:PropertyData><com:PropertyData > pkey="Status" > pvalue="FAILED"><com:PropertyData pkey="Message" > pvalue="ERR_CP_001"><com:PropertyData pkey="MessageDescr" > pvalue="NAME_1 is missing in source > document"/></com:PropertyData></com:PropertyData></com:Propert > yData></com:GenericDocument> > > can u please suggest , whats wrong here , how do i correct > this issue. > I am afraid , this is more of xslt specific question than > saxon , i apologise for that > > thanks for the help > Brijesh N K > > > brijesh wrote: > > > > Hi there, > > > > style sheet as below, > > > > > > <?xml version="1.0" encoding="utf-8"?> > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory" > > xmlns:java="http://saxon.sf.net/java-type" > > xmlns:saxon="http://saxon.sf.net/" > extension-element-prefixes="saxon" > > exclude-result-prefixes="java" version="1.0"> > > > > <xsl:variable name="count" select="0" saxon:assignable="yes" /> > > > > <xsl:template name="main" match="/"> > > > > > > <xsl:variable name="err_doc"> > > <xsl:call-template name="validate_doc" /> > > </xsl:variable> > > > > > > <!--<xsl:call-template name="validate_doc" /> --> > > > > <test> > > <xsl:copy-of select="$count" /> > > </test> > > > > </xsl:template> > > > > <xsl:template name="validate_doc"> > > <saxon:assign name="count" select="$count+1" /> > > > > <xsl:call-template name="applyTemplateForError" /> > > </xsl:template> > > > > <xsl:template name="applyTemplateForError"> > > <saxon:assign name="count" select="$count+1" /> > > </xsl:template> > > </xsl:stylesheet> > > > > When i execute i get the following result count value as 0. > Where as i am > > expecting count value as 2. > > > > <test xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory">0</test> > > > > count variable is global, hence the value should be 2, > > > > What am i doing wrong here? , instead of > > > > <xsl:variable name="err_doc"> > > <xsl:call-template name="validate_doc" /> > > </xsl:variable> > > > > if I execute > > > > <xsl:call-template name="validate_doc" /> , > > > > It works fine , Any input on this? > > > > > > > > > > Regards > > > > Brijesh N K > > > > > > -- > View this message in context: > http://old.nabble.com/not-able-to-reassing-value-to-saxon%3Aas > signable-variables-tp26128538p26159969.html > Sent from the saxon-help mailing list archive at Nabble.com. > > > -------------------------------------------------------------- > ---------------- > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. > Jumpstart your > developing skills, take BlackBerry mobile applications to > market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > saxon-help mailing list archived at http://saxon.markmail.org/ > saxon-help@... > https://lists.sourceforge.net/lists/listinfo/saxon-help ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: not able to reassing value to saxon:assignable variablesMichael ,
thanks for the response , I have trimmed down the xslt only for testing this issue, still getting the same document without namespace defenition. below is my xslt <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:com="com.ekaplus.commons.document" exclude-result-prefixes="com" version="1.0"> <xsl:template name="main" match="/"> <xsl:variable name="err_doc" > <xsl:element name="GenericDocument" namespace="com.ekaplus.commons.document"> <xsl:attribute name="document_Id"> <xsl:value-of select="'ERROR_DOC'"/> </xsl:attribute> <xsl:attribute name="description"> <xsl:value-of select="'Error document after validation'"/> </xsl:attribute> <xsl:attribute name="name"> <xsl:value-of select="'Error response document'"/> </xsl:attribute> <xsl:attribute name="created_date"> <xsl:value-of select="'2009-10-26'"/> </xsl:attribute> <xsl:element name="PropertyData" > <xsl:element name="PropertyData" > <xsl:attribute name="pkey"> <xsl:value-of select="'Status'"/> </xsl:attribute> <xsl:attribute name="pvalue"> <xsl:value-of select="'FAILED'"/> </xsl:attribute> </xsl:element> </xsl:element> </xsl:element> </xsl:variable> <xsl:copy-of select="$err_doc"/> </xsl:template > </xsl:stylesheet> when i run above xslt , output document apprears as follows , which is not well formed , <com:GenericDocument document_Id="ERROR_DOC" description="Error document after validation" name="Error response document" created_date="2009-10-26"><PropertyData><PropertyData pkey="Status" pvalue="FAILED"/></PropertyData></com:GenericDocument> don't know if i am making any mistake in stylesheet, please advice me. I use Saxon 8.9.03 with Stylus studio IDE prefession version , Java version is java version "1.5.0_07" Regards
|
|
|
Re: not able to reassing value to saxon:assignable variablesSorry, I still can't reproduce this. I've tried from the command line with Saxon 8.9.0.3, and I've tried from a version of Stylus Studio that is running Saxon 9.0.0.2, and both produce correct output. If you can reproduce this outside the Stylus environment, please let me know how. If you can't, you may have to direct the problem to the Stylus Studio support team. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: brijesh [mailto:brijeshnk@...] > Sent: 03 November 2009 11:17 > To: saxon-help@... > Subject: Re: [saxon] not able to reassing value to > saxon:assignable variables > > > Michael , > > thanks for the response , > > I have trimmed down the xslt only for testing this issue, > still getting the same document without namespace defenition. > below is my xslt > > <?xml version="1.0" encoding="utf-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:com="com.ekaplus.commons.document" > > exclude-result-prefixes="com" version="1.0"> > > > > <xsl:template name="main" match="/"> > > <xsl:variable name="err_doc" > > > > <xsl:element name="GenericDocument" > namespace="com.ekaplus.commons.document"> > <xsl:attribute name="document_Id"> > <xsl:value-of select="'ERROR_DOC'"/> > </xsl:attribute> > > <xsl:attribute name="description"> > <xsl:value-of select="'Error document > after validation'"/> > </xsl:attribute> > > > <xsl:attribute name="name"> > <xsl:value-of select="'Error response document'"/> > </xsl:attribute> > <xsl:attribute name="created_date"> > <xsl:value-of select="'2009-10-26'"/> > </xsl:attribute> > <xsl:element name="PropertyData" > > > <xsl:element name="PropertyData" > > > <xsl:attribute name="pkey"> > <xsl:value-of select="'Status'"/> > </xsl:attribute> > <xsl:attribute name="pvalue"> > <xsl:value-of select="'FAILED'"/> > </xsl:attribute> > > > </xsl:element> > </xsl:element> > </xsl:element> > </xsl:variable> > > <xsl:copy-of select="$err_doc"/> > </xsl:template > > > </xsl:stylesheet> > > when i run above xslt , output document apprears as follows , > which is not well formed , > > <com:GenericDocument document_Id="ERROR_DOC" > description="Error document after validation" name="Error > response document" > created_date="2009-10-26"><PropertyData><PropertyData pkey="Status" > pvalue="FAILED"/></PropertyData></com:GenericDocument> > don't know if i am making any mistake in stylesheet, please > advice me. > > I use Saxon 8.9.03 with Stylus studio IDE prefession version > , Java version is java version "1.5.0_07" > > Regards > > > > brijesh wrote: > > > > Hi there, > > > > style sheet as below, > > > > > > <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory" > > xmlns:java="http://saxon.sf.net/java-type" > > xmlns:saxon="http://saxon.sf.net/" > extension-element-prefixes="saxon" > > exclude-result-prefixes="java" version="1.0"> > > > > <xsl:variable name="count" select="0" saxon:assignable="yes" /> > > > > <xsl:template name="main" match="/"> > > > > > > <xsl:variable name="err_doc"> > > <xsl:call-template name="validate_doc" /> > > </xsl:variable> > > > > > > <!--<xsl:call-template name="validate_doc" /> --> > > > > <test> > > <xsl:copy-of select="$count" /> > > </test> > > > > </xsl:template> > > > > <xsl:template name="validate_doc"> > > <saxon:assign name="count" select="$count+1" /> > > > > <xsl:call-template name="applyTemplateForError" /> > > </xsl:template> > > > > <xsl:template name="applyTemplateForError"> > > <saxon:assign name="count" select="$count+1" /> > > </xsl:template> > > </xsl:stylesheet> > > > > When i execute i get the following result count value as 0. > Where as i > > am expecting count value as 2. > > > > <test xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory">0</test> > > > > count variable is global, hence the value should be 2, > > > > What am i doing wrong here? , instead of > > > > <xsl:variable name="err_doc"> > > <xsl:call-template name="validate_doc" /> > > </xsl:variable> > > > > if I execute > > > > <xsl:call-template name="validate_doc" /> , > > > > It works fine , Any input on this? > > > > > > > > > > Regards > > > > Brijesh N K > > > > > > -- > View this message in context: > http://old.nabble.com/not-able-to-reassing-value-to-saxon%3Aas > signable-variables-tp26128538p26160067.html > Sent from the saxon-help mailing list archive at Nabble.com. > > > -------------------------------------------------------------- > ---------------- > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. > Jumpstart your > developing skills, take BlackBerry mobile applications to > market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > saxon-help mailing list archived at http://saxon.markmail.org/ > saxon-help@... > https://lists.sourceforge.net/lists/listinfo/saxon-help ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: not able to reassing value to saxon:assignable variablesMichael ,
Thanks for the response , I tried same with Saxon 9.0.0.2 command line , It works fine .
issue with Stylus studio ,
thanks again for the clarification and help
Regards
Brijesh N K
On Tue, Nov 3, 2009 at 5:18 PM, Michael Kay <mike@...> wrote:
------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: not able to reassing value to saxon:assignable variablesNever assign to a variable, in the first place!
If you continue to do it, then don't think at all that you are using XSLT -- it would be much better to continue using your favorite imperative PL (such as Java). Functional programming is very different from imperative programming and requires a radical change of thinking -- something that doesn't happen overnight but is worth the effort. Try also learning another FP language, such as Haskell, using a good book. -- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk ------------------------------------- Never fight an inanimate object ------------------------------------- You've achieved success in your field when you don't know whether what you're doing is work or play On Tue, Nov 3, 2009 at 5:03 AM, Brijesh N K <brijeshnk@...> wrote: > Michael , > > Thanks for the response , I tried same with Saxon 9.0.0.2 command line , > It works fine . > issue with Stylus studio , > thanks again for the clarification and help > > Regards > Brijesh N K > > On Tue, Nov 3, 2009 at 5:18 PM, Michael Kay <mike@...> wrote: >> >> Sorry, I still can't reproduce this. I've tried from the command line with >> Saxon 8.9.0.3, and I've tried from a version of Stylus Studio that is >> running Saxon 9.0.0.2, and both produce correct output. >> >> If you can reproduce this outside the Stylus environment, please let me >> know >> how. If you can't, you may have to direct the problem to the Stylus Studio >> support team. >> >> Regards, >> >> Michael Kay >> http://www.saxonica.com/ >> http://twitter.com/michaelhkay >> >> >> > -----Original Message----- >> > From: brijesh [mailto:brijeshnk@...] >> > Sent: 03 November 2009 11:17 >> > To: saxon-help@... >> > Subject: Re: [saxon] not able to reassing value to >> > saxon:assignable variables >> > >> > >> > Michael , >> > >> > thanks for the response , >> > >> > I have trimmed down the xslt only for testing this issue, >> > still getting the same document without namespace defenition. >> > below is my xslt >> > >> > <?xml version="1.0" encoding="utf-8"?> >> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >> > xmlns:com="com.ekaplus.commons.document" >> > >> > exclude-result-prefixes="com" version="1.0"> >> > >> > >> > >> > <xsl:template name="main" match="/"> >> > >> > <xsl:variable name="err_doc" > >> > >> > >> > <xsl:element name="GenericDocument" >> > namespace="com.ekaplus.commons.document"> >> > <xsl:attribute name="document_Id"> >> > <xsl:value-of select="'ERROR_DOC'"/> >> > </xsl:attribute> >> > >> > <xsl:attribute name="description"> >> > <xsl:value-of select="'Error document >> > after validation'"/> >> > </xsl:attribute> >> > >> > >> > <xsl:attribute name="name"> >> > <xsl:value-of select="'Error response document'"/> >> > </xsl:attribute> >> > <xsl:attribute name="created_date"> >> > <xsl:value-of select="'2009-10-26'"/> >> > </xsl:attribute> >> > <xsl:element name="PropertyData" > >> > >> > <xsl:element name="PropertyData" > >> > >> > <xsl:attribute name="pkey"> >> > <xsl:value-of select="'Status'"/> >> > </xsl:attribute> >> > <xsl:attribute name="pvalue"> >> > <xsl:value-of select="'FAILED'"/> >> > </xsl:attribute> >> > >> > >> > </xsl:element> >> > </xsl:element> >> > </xsl:element> >> > </xsl:variable> >> > >> > <xsl:copy-of select="$err_doc"/> >> > </xsl:template >> > > >> > </xsl:stylesheet> >> > >> > when i run above xslt , output document apprears as follows , >> > which is not well formed , >> > >> > <com:GenericDocument document_Id="ERROR_DOC" >> > description="Error document after validation" name="Error >> > response document" >> > created_date="2009-10-26"><PropertyData><PropertyData pkey="Status" >> > pvalue="FAILED"/></PropertyData></com:GenericDocument> >> > don't know if i am making any mistake in stylesheet, please >> > advice me. >> > >> > I use Saxon 8.9.03 with Stylus studio IDE prefession version >> > , Java version is java version "1.5.0_07" >> > >> > Regards >> > >> > >> > >> > brijesh wrote: >> > > >> > > Hi there, >> > > >> > > style sheet as below, >> > > >> > > >> > > <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet >> > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >> > > xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory" >> > > xmlns:java="http://saxon.sf.net/java-type" >> > > xmlns:saxon="http://saxon.sf.net/" >> > extension-element-prefixes="saxon" >> > > exclude-result-prefixes="java" version="1.0"> >> > > >> > > <xsl:variable name="count" select="0" saxon:assignable="yes" /> >> > > >> > > <xsl:template name="main" match="/"> >> > > >> > > >> > > <xsl:variable name="err_doc"> >> > > <xsl:call-template name="validate_doc" /> >> > > </xsl:variable> >> > > >> > > >> > > <!--<xsl:call-template name="validate_doc" /> --> >> > > >> > > <test> >> > > <xsl:copy-of select="$count" /> >> > > </test> >> > > >> > > </xsl:template> >> > > >> > > <xsl:template name="validate_doc"> >> > > <saxon:assign name="count" select="$count+1" /> >> > > >> > > <xsl:call-template name="applyTemplateForError" /> >> > > </xsl:template> >> > > >> > > <xsl:template name="applyTemplateForError"> >> > > <saxon:assign name="count" select="$count+1" /> >> > > </xsl:template> >> > > </xsl:stylesheet> >> > > >> > > When i execute i get the following result count value as 0. >> > Where as i >> > > am expecting count value as 2. >> > > >> > > <test xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory">0</test> >> > > >> > > count variable is global, hence the value should be 2, >> > > >> > > What am i doing wrong here? , instead of >> > > >> > > <xsl:variable name="err_doc"> >> > > <xsl:call-template name="validate_doc" /> >> > > </xsl:variable> >> > > >> > > if I execute >> > > >> > > <xsl:call-template name="validate_doc" /> , >> > > >> > > It works fine , Any input on this? >> > > >> > > >> > > >> > > >> > > Regards >> > > >> > > Brijesh N K >> > > >> > > >> > >> > -- >> > View this message in context: >> > http://old.nabble.com/not-able-to-reassing-value-to-saxon%3Aas >> > signable-variables-tp26128538p26160067.html >> > Sent from the saxon-help mailing list archive at Nabble.com. >> > >> > >> > -------------------------------------------------------------- >> > ---------------- >> > Come build with us! The BlackBerry(R) Developer Conference in SF, CA >> > is the only developer event you need to attend this year. >> > Jumpstart your >> > developing skills, take BlackBerry mobile applications to >> > market and stay >> > ahead of the curve. Join us from November 9 - 12, 2009. Register now! >> > http://p.sf.net/sfu/devconference >> > _______________________________________________ >> > saxon-help mailing list archived at http://saxon.markmail.org/ >> > saxon-help@... >> > https://lists.sourceforge.net/lists/listinfo/saxon-help >> >> >> >> ------------------------------------------------------------------------------ >> Come build with us! The BlackBerry(R) Developer Conference in SF, CA >> is the only developer event you need to attend this year. Jumpstart your >> developing skills, take BlackBerry mobile applications to market and stay >> ahead of the curve. Join us from November 9 - 12, 2009. Register now! >> http://p.sf.net/sfu/devconference >> _______________________________________________ >> saxon-help mailing list archived at http://saxon.markmail.org/ >> saxon-help@... >> https://lists.sourceforge.net/lists/listinfo/saxon-help > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > saxon-help mailing list archived at http://saxon.markmail.org/ > saxon-help@... > https://lists.sourceforge.net/lists/listinfo/saxon-help > ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: not able to reassing value to saxon:assignable variablesDimitre, thanks a lot for the advice, will learn improve my xslt skill,
Regards
Brijesh N K
On Tue, Nov 3, 2009 at 6:51 PM, Dimitre Novatchev <dnovatchev@...> wrote: Never assign to a variable, in the first place! ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
| Free embeddable forum powered by Nabble | Forum Help |