Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 15th, 2007, 09:33 AM
Registered User
 
Join Date: Jun 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is the error message that I am getting:

javax.xml.transform.TransformerConfigurationExcept ion: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: Expected ), but found: ,

Here is the complete stack trace:
[6/15/07 9:20:31:723 CDT] 0000002b SystemOut O fileName from the system classloader: file:/C:/Program%20Files/IBM/Rational/SDP/6.0/runtimes/base_v6/profiles/default/properties/MulticoToPos.xsl
[6/15/07 9:20:33:164 CDT] 0000002b SystemOut O is: java.io.BufferedInputStream@d460aff
[6/15/07 9:22:14:511 CDT] 0000002b SystemErr R javax.xml.transform.TransformerConfigurationExcept ion: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: Expected ), but found: ,
[6/15/07 9:22:14:511 CDT] 0000002b SystemErr R at org.apache.xalan.processor.TransformerFactoryImpl. newTemplates(TransformerFactoryImpl.java:844)
[6/15/07 9:22:14:511 CDT] 0000002b SystemErr R at com.ibm.debug.xdi.jaxp.xalan.interpreted.DebugTran sformerFactory.newTemplates(DebugTransformerFactor y.java:297)
[6/15/07 9:22:14:511 CDT] 0000002b SystemErr R at com.kai.nb.utilities.XMLTransformer.transform(XMLT ransformer.java:98)
[6/15/07 9:22:14:511 CDT] 0000002b SystemErr R at com.kai.nb.utilities.Util.getTransformedXml(Util.j ava:91)
[6/15/07 9:22:14:511 CDT] 0000002b SystemErr R at com.kai.nb.ejb.PopulatePolicyRequestBean.invokeSer vice(PopulatePolicyRequestBean.java:68)
[6/15/07 9:22:14:511 CDT] 0000002b SystemErr R at com.kai.nb.ejb.EJSRemoteStatelessPopulatePolicyReq uest_aee4393a.invokeService(EJSRemoteStatelessPopu latePolicyRequest_aee4393a.java:28)
[6/15/07 9:22:14:511 CDT] 0000002b SystemErr R at com.kai.nb.ejb._PopulatePolicyRequest_Stub.invokeS ervice(_PopulatePolicyRequest_Stub.java:255)
[6/15/07 9:22:14:511 CDT] 0000002b SystemErr R at com.kai.cri.router.ejb.RouterBean.invokeService(Ro uterBean.java:59)
[6/15/07 9:22:14:511 CDT] 0000002b SystemErr R at com.kai.cri.router.ejb.EJSRemoteStatelessRouter_ff 38bf75.invokeService(EJSRemoteStatelessRouter_ff38 bf75.java:29)
[6/15/07 9:22:14:511 CDT] 0000002b SystemErr R at com.kai.cri.router.ejb._Router_Stub.invokeService( _Router_Stub.java:259)
[6/15/07 9:22:14:511 CDT] 0000002b SystemErr R at com.kai.nb.NewBizUtil.invokeRouter(NewBizUtil.java :66)
[6/15/07 9:22:14:511 CDT] 0000002b SystemErr R at com.kai.nb.presentation.servlet.RaterLogonServlet. doPost(RaterLogonServlet.java:150)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet .java:763)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.ser vice(ServletWrapper.java:1212)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.han dleRequest(ServletWrapper.java:629)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at com.ibm.ws.webcontainer.webapp.WebApp.handleReques t(WebApp.java:2837)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequ est(WebGroup.java:220)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at com.ibm.ws.webcontainer.VirtualHost.handleRequest( VirtualHost.java:204)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at com.ibm.ws.webcontainer.WebContainer.handleRequest (WebContainer.java:1681)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at com.ibm.ws.webcontainer.channel.WCChannelLink.read y(WCChannelLink.java:77)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.handleDiscrimination(HttpInboundLink.java:421)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.handleNewInformation(HttpInboundLink.java:367)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCa llback.complete(HttpICLReadCallback.java:94)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at com.ibm.ws.tcp.channel.impl.WorkQueueManager.reque stComplete(WorkQueueManager.java:548)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attem ptIO(WorkQueueManager.java:601)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at com.ibm.ws.tcp.channel.impl.WorkQueueManager.worke rRun(WorkQueueManager.java:934)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worke r.run(WorkQueueManager.java:1021)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:1332)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R Caused by: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: Expected ), but found: ,
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at org.apache.xalan.processor.TransformerFactoryImpl. newTemplates(TransformerFactoryImpl.java:840)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R ... 28 more
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R Caused by: javax.xml.transform.TransformerException: Expected ), but found: ,
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at org.apache.xalan.processor.XSLTAttributeDef.proces sEXPR(XSLTAttributeDef.java:768)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at org.apache.xalan.processor.XSLTAttributeDef.proces sValue(XSLTAttributeDef.java:1404)
[6/15/07 9:22:14:526 CDT] 0000002b SystemErr R at org.apache.xalan.processor.XSLTAttributeDef.setAtt rValue(XSLTAttributeDef.java:1600)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xalan.processor.XSLTElementProcessor.se tPropertiesFromAttributes(XSLTElementProcessor.jav a:343)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xalan.processor.XSLTElementProcessor.se tPropertiesFromAttributes(XSLTElementProcessor.jav a:268)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xalan.processor.ProcessorTemplateElem.s tartElement(ProcessorTemplateElem.java:78)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xalan.processor.StylesheetHandler.start Element(StylesheetHandler.java:600)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at com.ibm.debug.xdi.jaxp.xalan.interpreted.DebugStyl esheetHandler.startElement(DebugStylesheetHandler. java:284)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xerces.parsers.AbstractSAXParser.startE lement(Unknown Source)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xerces.impl.XMLNamespaceBinder.handleSt artElement(Unknown Source)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xerces.impl.XMLNamespaceBinder.startEle ment(Unknown Source)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl.scanStartElement(Unknown Source)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl$FragmentContentDispatcher.dispatch(Unknown Source)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl.scanDocument(Unknown Source)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xerces.parsers.DTDConfiguration.parse(U nknown Source)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xerces.parsers.DTDConfiguration.parse(U nknown Source)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xerces.parsers.AbstractSAXParser.parse( Unknown Source)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xalan.templates.StylesheetRootProxy.<in it>(StylesheetRootProxy.java:63)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R at org.apache.xalan.processor.TransformerFactoryImpl. newTemplates(TransformerFactoryImpl.java:832)
[6/15/07 9:22:14:542 CDT] 0000002b SystemErr R ... 28 more
[6/15/07 9:22:21:716 CDT] 00000019 TimeoutManage I WTRN0006W: Transaction 000001132FC1935200000001000000094E0E6975487D1D8BA3 50998F899110229DF7DE52000001132FC19352000000010000 00094E0E6975487D1D8BA350998F899110229DF7DE52000000 01 has timed out after 120 seconds.

Here is the XSLT file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>


        <xsl:template match="/ACORD">
        <policy>
            <pos_policy>
            <assigned_risk></assigned_risk>
            <company>
                <xsl:value-of select="translate(/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersPolicy/CompanyProductCd, 'UCC', '5')"/>
            </company>
            <discount_mask></discount_mask>
            <home_owner_flag>
                <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersPolicy/PersApplicationInfo/ResidenceOwnedRentedCd"/>
            </home_owner_flag>
            <finance></finance>
            <liability_limits></liability_limits>
            <mono_line_flag></mono_line_flag>
            <policy_state>
                <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersPolicy/ControllingStateProvCd"/>
            </policy_state>
            <policy_term>
                <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersPolicy/ContractTerm/DurationPeriod/NumUnits"/>
            </policy_term>
            <policy_type>
                <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersPolicy/LOBCd"/>
            </policy_type>
            <producer>
                <xsl:value-of select="/ACORD/SignonRq/SignonPswd/CustId/CustLoginId"/>
            </producer>
            <program>
                <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersPolicy/CompanyProgram"/>
            </program>
            <rate_zip>
            </rate_zip>
            <receive_date>
            </receive_date>
            <inception_date>
                <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersPolicy/ContractTerm/EffectiveDt"/>
            </inception_date>
            <subcompany></subcompany>
            <policy_address>
                <address1>
                    <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/InsuredOrPrincipal/GeneralPartyInfo/Addr/Addr1"/>
                </address1>
                <address2>
                    <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/InsuredOrPrincipal/GeneralPartyInfo/Addr/Addr2"/>
                </address2>
                <city>
                    <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/InsuredOrPrincipal/GeneralPartyInfo/Addr/City"/>
                </city>
                <state>
                    <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/InsuredOrPrincipal/GeneralPartyInfo/Addr/StateProvCd"/>
                </state>
                <zip>
                    <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/InsuredOrPrincipal/GeneralPartyInfo/Addr/PostalCode"/>
                </zip>
                <county>
                    <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/InsuredOrPrincipal/GeneralPartyInfo/Addr/County"/>
                </county>
                <telephone>
                    <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/InsuredOrPrincipal/GeneralPartyInfo/Communications/PhoneInfo/PhoneNumber"/>
                </telephone>
            </policy_address>
            </pos_policy>


            <drivers>
                <xsl:for-each select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersDriver[@id=('1','2')]">
                  <driver>
                      <driver_number>
                        <xsl:value-of select="substring-after(/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersDriver/@id, 'PersDriver')"/>
                      </driver_number>
                    <first_name>
                        <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersDriver/GeneralPartyInfo/NameInfo/PersonName/GivenName"/>
                    </first_name>
                    <initial>
                        <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersDriver/GeneralPartyInfo/NameInfo/PersonName/OtherGivenName"/>
                    </initial>
                    <last_name>
                        <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersDriver/GeneralPartyInfo/NameInfo/PersonName/Surname"/>
                    </last_name>
                    <license_number>
                        <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersDriver/DriverInfo/DriversLicense/DriversLicenseNumber"/>
                    </license_number>
                    <birth_date>
                        <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersDriver/DriverInfo/PersonInfo/BirthDt"/>
                    </birth_date>
                    <************>
                        <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersDriver/DriverInfo/PersonInfo/GenderCd"/>
                    </************>
                    <marital_status>
                        <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersDriver/DriverInfo/PersonInfo/MaritalStatusCd"/>
                    </marital_status>
                    <occupation>
                        <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersDriver/DriverInfo/PersonInfo/MaritalStatusCd"/>
                    </occupation>
                    <license_state>
                        <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersDriver/DriverInfo/DriversLicense/StateProvCd"/>
                    </license_state>
                    <sr22_flag>
                        <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersDriver/PersDriverInfo/FinancialResponsibilityFiling/FilingStatusCd"/>
                    </sr22_flag>
                    <relationship_type>
                        <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersDriver/PersDriverInfo/DriverRelationshipToApplicantCd"/>
                    </relationship_type>
                 </driver>
               </xsl:for-each>
            </drivers>

            <vehicles>
                <xsl:for-each select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh[@id]">
                    <vehicle>
                          <vehicle_number>
                            <xsl:value-of select="substring-after(PersVeh/@id, 'PersVeh')"/>
                          </vehicle_number>
                          <vin>
                            <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/VehIdentificationNumber"/>
                          </vin>
                          <vehicle_year>
                            <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/ModelYear"/>
                          </vehicle_year>
                          <vehicle_make>
                            <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/Manufacturer"/>
                          </vehicle_make>
                          <vehicle_model>
                            <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/Model"/>
                          </vehicle_model>
                          <vehicle_symbol>
                              <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/VehSymbolCd"/>
                          </vehicle_symbol>
                          <special_equip_description>
                              <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/AlterationsAmt/Amt"/>
                          </special_equip_description>
                          <use_code>
                                <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/VehUSeCd"/>
                        </use_code>
                          <body_type>
                                <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/VehBodyTypeCd"/>
                          </body_type>
                          <cc>
                                <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/NumCylinders"/>
                          </cc>
                          <vehicle_coverages>
                            <xsl:apply-templates select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/Coverage"/>
                          </vehicle_coverages>
                    </vehicle>
                </xsl:for-each>
            </vehicles>
            </policy>

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

          <xsl:template match="Coverage">
            <vehicle_coverage>
                  <vehicle_number>
                    <xsl:value-of select="substring-after(/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/@id, 'PersVeh')"/>
                  </vehicle_number>
                  <coverage>
                        <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/Coverage/CoverageCd"/>
                  </coverage>
                  <coverage_limits>
                  <xsl:variable name="cov_cd">
                        <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/Coverage/CoverageCd"/>
                </xsl:variable>
                  <xsl:choose>
                <xsl:when test="$cov_cd='BI'">
                            <xsl:value-of select="concat(/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/Coverage/Limit/FormatInteger[1], '/',
                            /ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/Coverage/Limit/FormatInteger[2])"/>
                  </xsl:when>
                  </xsl:choose>

                    </coverage_limits>

                  <pure_premium>
                      <xsl:value-of select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersVeh/Coverage/CurrentTermAmt/Amt"/>/
                  </pure_premium>
                  <term_premium></term_premium>
                  <cancel_premium></cancel_premium>
                  <endorsement_earnings></endorsement_earnings>
              </vehicle_coverage>
          </xsl:template>




</xsl:stylesheet>

Here is the transormation code:
public String transform(String inFilename, InputStream is) {

        String resultStr = null;
        try {
            byte arrBytes[] = null;
            arrBytes = inFilename.getBytes();

            // Create transformer factory
            TransformerFactory factory = TransformerFactory.newInstance();

            // Use the factory to create a template containing the xsl file
            Templates template = factory.newTemplates(new StreamSource(is));

            // Use the template to create a transformer
            Transformer xformer = template.newTransformer();

            // Prepare the input and output files
            Source source = new StreamSource(new ByteArrayInputStream(arrBytes));

            StringWriter sw = new StringWriter();
            Result result = new StreamResult(sw);

            // Apply the xsl file to the source file and write the result to the output file
            xformer.transform(source, result);

            resultStr = sw.getBuffer().toString();
            System.out.println ("***** In transform(), resultStr2: " + resultStr);

        } catch (TransformerConfigurationException e) {
            // An error occurred in the XSL file
            e.printStackTrace();
        } catch (TransformerException e) {
            // An error occurred while applying the XSL file
            SourceLocator locator = e.getLocator();
            int col = locator.getColumnNumber();
            System.out.println ("***** In transform(), col: " + col);

            int line = locator.getLineNumber();
            System.out.println ("***** In transform(), line: " + line);

            String publicId = locator.getPublicId();
            System.out.println ("***** In transform(), publicId: " + publicId);

            String systemId = locator.getSystemId();
            System.out.println ("***** In transform(), systemId: " + systemId);

        }
        return resultStr;
    }

Thanks!

 
Old June 15th, 2007, 09:53 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Your catch clauses in the Java are producing nothing but a stack trace when you get an error in the stylesheet. Change the code for catching a TransformerConfigurationException, use the same code as you use for handling a TransformerException, and you should see the line and column information.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 15th, 2007, 09:55 AM
Registered User
 
Join Date: Jun 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, thanks for your response! I will try that.

 
Old June 17th, 2007, 08:40 PM
Registered User
 
Join Date: Jun 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I put the following code in the catch block of TransformationConfigurationException:

try {
........
} catch (TransformerConfigurationException e) {
     // An error occurred in the XSL file

      System.out.println ("***** In TransformerConfigurationException, location string: " + e.getLocationAsString());
      System.out.println ("***** In TransformerConfigurationException, localized message: " + e.getLocalizedMessage());
       System.out.println ("***** In TransformerConfigurationException, message and location string: " + e.getMessageAndLocation());
        System.out.println ("***** In TransformerConfigurationException, message: " + e.getMessage());
            System.out.println ("***** In TransformerConfigurationException, cause: " + e.getCause().toString());
}

The above code is producing the following output:

[6/17/07 20:10:13:152 CDT] 0000003f SystemOut O ***** In TransformerConfigurationException, location string: null
[6/17/07 20:10:33:280 CDT] 0000003f SystemOut O ***** In TransformerConfigurationException, localized message: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: Expected ), but found: ,
[6/17/07 20:10:56:745 CDT] 0000003f SystemOut O ***** In TransformerConfigurationException, message and location string: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: Expected ), but found: ,
[6/17/07 20:11:09:762 CDT] 0000003f SystemOut O ***** In TransformerConfigurationException, message: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: Expected ), but found: ,
[6/17/07 20:11:23:922 CDT] 0000003f SystemOut O ***** In TransformerConfigurationException, cause: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: Expected ), but found: ,

If I use the following code, the SourceLocator object prints as null. So the code after that produces a NullPointerException.
try {
.....
} catch (TransformationConfigurationException e) {
     SourceLocator locator = e.getLocator();
     int col = locator.getColumnNumber();
     System.out.println ("***** In TransformerConfigurationException, col: " + col);
     int line = locator.getLineNumber();
     System.out.println ("***** In TransformerConfigurationException, line: " + line);
      String publicId = locator.getPublicId();
      System.out.println ("***** In TransformerConfigurationException, publicId: " + publicId);
      String systemId = locator.getSystemId();
      System.out.println ("***** In TransformerConfigurationException, systemId: " + systemId);
      e.printStackTrace();
}

However, I know that as soon as I change the following code:
            a.) <xsl:for-each select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersDriver[@id]">
to the following:
            b.) <xsl:for-each select="/ACORD/InsuranceSvcRq/PersAutoPolicyQuoteInqRq/PersAutoLineBusiness/PersDriver[@id=('1','2')]">
I get the above mentioned error. I am not sure why the line a.) is printing only the first driver 3 times.

Thanks!



 
Old June 18th, 2007, 03:30 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

This syntax:

[@id=('1','2')]

is only available in XSLT 2.0. Either switch to a 2.0 processor, or use

[@id='1' or @id='2']

I don't know why you're not getting line numbers, not being an expert in Xalan. You might find it easier to do the basic development and debugging of your stylesheets from the command line.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 18th, 2007, 09:40 AM
Registered User
 
Join Date: Jun 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, I will try both the options, suggested by you. Thanks for your help!






Similar Threads
Thread Thread Starter Forum Replies Last Post
help in selecting elements spandit XSLT 1 April 9th, 2007 07:27 PM
Selecting unique set of elements Chamkaur XSLT 1 March 15th, 2007 05:43 AM
selecting elements from comma separated list rjonk XSLT 4 September 29th, 2006 08:46 AM
Selecting elements up until a certain one Frode XSLT 5 January 19th, 2006 01:22 PM
selecting certain xml elements fogofogo XML 2 December 5th, 2005 07:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.