|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Line numbers not correctHi,
I am using saxon:line-number() to get the line numbers. The context is in a different line number than the number reported by saxon:line-number(). It differs by a few lines. Trying to understand whether this one is acceptable or I am not using this correctly. Any help appreciated. Sample xsl that is applied. <xsl:template match="*[cda:templateId/@root="2.16.840.1.113883.10.20.1.24"][ancestor::cda:section/cda:templateId/@root="2.16.840.1.113883.10.20.1.8"]" priority="1001" mode="M69"> <svrl:fired-rule xmlns:saxon="http://saxon.sf.net/" xmlns:svrl="http://purl.oclc.org/dsdl/svrl" context="*[cda:templateId/@root="2.16.840.1.113883.10.20.1.24"][ancestor::cda:section/cda:templateId/@root="2.16.840.1.113883.10.20.1.8"]"/> <!--ASSERT --> <xsl:choose> <xsl:when test="count(cda:statusCode)=1"/> <xsl:otherwise> <svrl:failed-assert xmlns:saxon="http://saxon.sf.net/" xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="count(cda:statusCode)=1"> <xsl:attribute name="location"> <xsl:apply-templates select="." mode="schematron-select-full-path"/> </xsl:attribute> <svrl:text><xsl:value-of select="saxon:line-number($node)"/>-<xsl:text/>A medication activity SHOULD contain exactly one SubstanceAdministration / statusCode.</svrl:text> </svrl:failed-assert> </xsl:otherwise> </xsl:choose> Thanks, Swami. ------------------------------------------------------------------------------ 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: Line numbers not correctIf you are using a SAX parser (which is the normal case), then the line number is that defined by the SAX specification. For an element node, the line number is therefore the line containing the ">" at the end of the start tag. For a node other than an element, the line number is that of the containing element. When you have an element with many attributes written one per line, the line number can certainly be out by a few lines from what you might expect. I can't quite see what you expect me to get from your specimen code. All I can see is that the code fragment applies saxon:line-number() to a variable called $node, whose declaration is not included in this code fragment. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: Swami Rajagopalan [mailto:swamigee_123@...] > Sent: 22 October 2009 23:07 > To: saxon-help@... > Subject: [saxon] Line numbers not correct > > Hi, > I am using saxon:line-number() to get the line numbers. > The context is in a different line number than the number > reported by saxon:line-number(). > It differs by a few lines. > Trying to understand whether this one is acceptable or I am > not using this correctly. > Any help appreciated. > > Sample xsl that is applied. > > <xsl:template > match="*[cda:templateId/@root="2.16.840.1.113883.10.20.1.2 > 4"][ancestor::cda:section/cda:templateId/@root="2.16.8 > 40.1.113883.10.20.1.8"]" > priority="1001" > mode="M69"> > <svrl:fired-rule xmlns:saxon="http://saxon.sf.net/" > xmlns:svrl="http://purl.oclc.org/dsdl/svrl" > > context="*[cda:templateId/@root="2.16.840.1.113883.10.20.1 > .24"][ancestor::cda:section/cda:templateId/@root="2.16 > .840.1.113883.10.20.1.8"]"/> > > <!--ASSERT --> > <xsl:choose> > <xsl:when test="count(cda:statusCode)=1"/> > <xsl:otherwise> > <svrl:failed-assert > xmlns:saxon="http://saxon.sf.net/" > xmlns:svrl="http://purl.oclc.org/dsdl/svrl" > test="count(cda:statusCode)=1"> > <xsl:attribute name="location"> > <xsl:apply-templates select="." > mode="schematron-select-full-path"/> > </xsl:attribute> > <svrl:text><xsl:value-of > select="saxon:line-number($node)"/>-<xsl:text/>A medication > activity SHOULD contain exactly one SubstanceAdministration / > statusCode.</svrl:text> > </svrl:failed-assert> > </xsl:otherwise> > </xsl:choose> > > Thanks, > Swami. > > > > > > -------------------------------------------------------------- > ---------------- > 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: Line numbers not correctHi,
It might be that you apply saxon:line-number on the source document copy (but not the document itself). In this case line-number will return incorrect value.
On Fri, Oct 23, 2009 at 12:06 AM, Swami Rajagopalan <swamigee_123@...> wrote: Hi, ------------------------------------------------------------------------------ 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: Line numbers not correctThanks Michael for the response.
The line number difference matched with the number of comments. After I removed the comments and other lines the line numbers are exact e.g. <?xml version="1.0" encoding="utf-8"?> <!-- with CCD stylesheet --> <!-- <?xml-stylesheet type='text/xsl' href='CCD.xsl'?> --> <!-- with CDA stylesheet --> <?xml-stylesheet type='text/xsl' href='cda.xsl'?>. Is there any option to strip the comments? I use TransformerFactory tfactory = TransformerFactory.newInstance(); tfactory.setAttribute(FeatureKeys.LINE_NUMBERING, new Boolean(true)); Thanks, Swami. ----- Original Message ---- From: Michael Kay <mike@...> To: Mailing list for the SAXON XSLT and XQuery processor <saxon-help@...> Sent: Thu, October 22, 2009 7:03:52 PM Subject: Re: [saxon] Line numbers not correct If you are using a SAX parser (which is the normal case), then the line number is that defined by the SAX specification. For an element node, the line number is therefore the line containing the ">" at the end of the start tag. For a node other than an element, the line number is that of the containing element. When you have an element with many attributes written one per line, the line number can certainly be out by a few lines from what you might expect. I can't quite see what you expect me to get from your specimen code. All I can see is that the code fragment applies saxon:line-number() to a variable called $node, whose declaration is not included in this code fragment. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: Swami Rajagopalan [mailto:swamigee_123@...] > Sent: 22 October 2009 23:07 > To: saxon-help@... > Subject: [saxon] Line numbers not correct > > Hi, > I am using saxon:line-number() to get the line numbers. > The context is in a different line number than the number > reported by saxon:line-number(). > It differs by a few lines. > Trying to understand whether this one is acceptable or I am > not using this correctly. > Any help appreciated. > > Sample xsl that is applied. > > <xsl:template > match="*[cda:templateId/@root="2.16.840.1.113883.10.20.1.2 > 4"][ancestor::cda:section/cda:templateId/@root="2.16.8 > 40.1.113883.10.20.1.8"]" > priority="1001" > mode="M69"> > <svrl:fired-rule xmlns:saxon="http://saxon.sf.net/" > xmlns:svrl="http://purl.oclc.org/dsdl/svrl" > > context="*[cda:templateId/@root="2.16.840.1.113883.10.20.1 > .24"][ancestor::cda:section/cda:templateId/@root="2.16 > .840.1.113883.10.20.1.8"]"/> > > <!--ASSERT --> > <xsl:choose> > <xsl:when test="count(cda:statusCode)=1"/> > <xsl:otherwise> > <svrl:failed-assert > xmlns:saxon="http://saxon.sf.net/" > xmlns:svrl="http://purl.oclc.org/dsdl/svrl" > test="count(cda:statusCode)=1"> > <xsl:attribute name="location"> > <xsl:apply-templates select="." > mode="schematron-select-full-path"/> > </xsl:attribute> > <svrl:text><xsl:value-of > select="saxon:line-number($node)"/>-<xsl:text/>A medication > activity SHOULD contain exactly one SubstanceAdministration / > statusCode.</svrl:text> > </svrl:failed-assert> > </xsl:otherwise> > </xsl:choose> > > Thanks, > Swami. > > > > > > -------------------------------------------------------------- > ---------------- > 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: Line numbers not correctThis sounds like a bug in the XML parser. Which XML parser are you using? Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: Swami Rajagopalan [mailto:swamigee_123@...] > Sent: 23 October 2009 18:00 > To: Mailing list for the SAXON XSLT and XQuery processor > Subject: Re: [saxon] Line numbers not correct > > Thanks Michael for the response. > > The line number difference matched with the number of comments. > After I removed the comments and other lines the line numbers > are exact e.g. > <?xml version="1.0" encoding="utf-8"?> > <!-- with CCD stylesheet --> > <!-- <?xml-stylesheet type='text/xsl' href='CCD.xsl'?> --> > <!-- with CDA stylesheet --> > <?xml-stylesheet type='text/xsl' href='cda.xsl'?>. > > Is there any option to strip the comments? > > I use > TransformerFactory tfactory = > TransformerFactory.newInstance(); > tfactory.setAttribute(FeatureKeys.LINE_NUMBERING, new Boolean(true)); > > > Thanks, > Swami. > > > > ----- Original Message ---- > From: Michael Kay <mike@...> > To: Mailing list for the SAXON XSLT and XQuery processor > <saxon-help@...> > Sent: Thu, October 22, 2009 7:03:52 PM > Subject: Re: [saxon] Line numbers not correct > > > If you are using a SAX parser (which is the normal case), > then the line > number is that defined by the SAX specification. For an > element node, the > line number is therefore the line containing the ">" at the > end of the start > tag. For a node other than an element, the line number is that of the > containing element. > > When you have an element with many attributes written one per > line, the line > number can certainly be out by a few lines from what you might expect. > > I can't quite see what you expect me to get from your > specimen code. All I > can see is that the code fragment applies saxon:line-number() > to a variable > called $node, whose declaration is not included in this code fragment. > > Regards, > > Michael Kay > http://www.saxonica.com/ > http://twitter.com/michaelhkay > > > -----Original Message----- > > From: Swami Rajagopalan [mailto:swamigee_123@...] > > Sent: 22 October 2009 23:07 > > To: saxon-help@... > > Subject: [saxon] Line numbers not correct > > > > Hi, > > I am using saxon:line-number() to get the line numbers. > > The context is in a different line number than the number > > reported by saxon:line-number(). > > It differs by a few lines. > > Trying to understand whether this one is acceptable or I am > > not using this correctly. > > Any help appreciated. > > > > Sample xsl that is applied. > > > > <xsl:template > > match="*[cda:templateId/@root="2.16.840.1.113883.10.20.1.2 > > 4"][ancestor::cda:section/cda:templateId/@root="2.16.8 > > 40.1.113883.10.20.1.8"]" > > priority="1001" > > mode="M69"> > > <svrl:fired-rule xmlns:saxon="http://saxon.sf.net/" > > xmlns:svrl="http://purl.oclc.org/dsdl/svrl" > > > > context="*[cda:templateId/@root="2.16.840.1.113883.10.20.1 > > .24"][ancestor::cda:section/cda:templateId/@root="2.16 > > .840.1.113883.10.20.1.8"]"/> > > > > <!--ASSERT --> > > <xsl:choose> > > <xsl:when test="count(cda:statusCode)=1"/> > > <xsl:otherwise> > > <svrl:failed-assert > > xmlns:saxon="http://saxon.sf.net/" > > xmlns:svrl="http://purl.oclc.org/dsdl/svrl" > > test="count(cda:statusCode)=1"> > > <xsl:attribute name="location"> > > <xsl:apply-templates select="." > > mode="schematron-select-full-path"/> > > </xsl:attribute> > > <svrl:text><xsl:value-of > > select="saxon:line-number($node)"/>-<xsl:text/>A medication > > activity SHOULD contain exactly one SubstanceAdministration / > > statusCode.</svrl:text> > > </svrl:failed-assert> > > </xsl:otherwise> > > </xsl:choose> > > > > Thanks, > > Swami. > > > > > > > > > > > > -------------------------------------------------------------- > > ---------------- > > 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: Line numbers not correctI am using xercesImpl-2.8.1
-Swami. ----- Original Message ---- From: Michael Kay <mike@...> To: Mailing list for the SAXON XSLT and XQuery processor <saxon-help@...> Sent: Fri, October 23, 2009 1:58:28 PM Subject: Re: [saxon] Line numbers not correct This sounds like a bug in the XML parser. Which XML parser are you using? Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: Swami Rajagopalan [mailto:swamigee_123@...] > Sent: 23 October 2009 18:00 > To: Mailing list for the SAXON XSLT and XQuery processor > Subject: Re: [saxon] Line numbers not correct > > Thanks Michael for the response. > > The line number difference matched with the number of comments. > After I removed the comments and other lines the line numbers > are exact e.g. > <?xml version="1.0" encoding="utf-8"?> > <!-- with CCD stylesheet --> > <!-- <?xml-stylesheet type='text/xsl' href='CCD.xsl'?> --> > <!-- with CDA stylesheet --> > <?xml-stylesheet type='text/xsl' href='cda.xsl'?>. > > Is there any option to strip the comments? > > I use > TransformerFactory tfactory = > TransformerFactory.newInstance(); > tfactory.setAttribute(FeatureKeys.LINE_NUMBERING, new Boolean(true)); > > > Thanks, > Swami. > > > > ----- Original Message ---- > From: Michael Kay <mike@...> > To: Mailing list for the SAXON XSLT and XQuery processor > <saxon-help@...> > Sent: Thu, October 22, 2009 7:03:52 PM > Subject: Re: [saxon] Line numbers not correct > > > If you are using a SAX parser (which is the normal case), > then the line > number is that defined by the SAX specification. For an > element node, the > line number is therefore the line containing the ">" at the > end of the start > tag. For a node other than an element, the line number is that of the > containing element. > > When you have an element with many attributes written one per > line, the line > number can certainly be out by a few lines from what you might expect. > > I can't quite see what you expect me to get from your > specimen code. All I > can see is that the code fragment applies saxon:line-number() > to a variable > called $node, whose declaration is not included in this code fragment. > > Regards, > > Michael Kay > http://www.saxonica.com/ > http://twitter.com/michaelhkay > > > -----Original Message----- > > From: Swami Rajagopalan [mailto:swamigee_123@...] > > Sent: 22 October 2009 23:07 > > To: saxon-help@... > > Subject: [saxon] Line numbers not correct > > > > Hi, > > I am using saxon:line-number() to get the line numbers. > > The context is in a different line number than the number > > reported by saxon:line-number(). > > It differs by a few lines. > > Trying to understand whether this one is acceptable or I am > > not using this correctly. > > Any help appreciated. > > > > Sample xsl that is applied. > > > > <xsl:template > > match="*[cda:templateId/@root="2.16.840.1.113883.10.20.1.2 > > 4"][ancestor::cda:section/cda:templateId/@root="2.16.8 > > 40.1.113883.10.20.1.8"]" > > priority="1001" > > mode="M69"> > > <svrl:fired-rule xmlns:saxon="http://saxon.sf.net/" > > xmlns:svrl="http://purl.oclc.org/dsdl/svrl" > > > > context="*[cda:templateId/@root="2.16.840.1.113883.10.20.1 > > .24"][ancestor::cda:section/cda:templateId/@root="2.16 > > .840.1.113883.10.20.1.8"]"/> > > > > <!--ASSERT --> > > <xsl:choose> > > <xsl:when test="count(cda:statusCode)=1"/> > > <xsl:otherwise> > > <svrl:failed-assert > > xmlns:saxon="http://saxon.sf.net/" > > xmlns:svrl="http://purl.oclc.org/dsdl/svrl" > > test="count(cda:statusCode)=1"> > > <xsl:attribute name="location"> > > <xsl:apply-templates select="." > > mode="schematron-select-full-path"/> > > </xsl:attribute> > > <svrl:text><xsl:value-of > > select="saxon:line-number($node)"/>-<xsl:text/>A medication > > activity SHOULD contain exactly one SubstanceAdministration / > > statusCode.</svrl:text> > > </svrl:failed-assert> > > </xsl:otherwise> > > </xsl:choose> > > > > Thanks, > > Swami. > > > > > > > > > > > > -------------------------------------------------------------- > > ---------------- > > 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 ------------------------------------------------------------------------------ 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: Line numbers not correctI don't have 2.8.1 installed, but with 2.9.1 I get correct results. With
this source document (test.xml) <?xml version="1.0" encoding="utf-8"?> <!-- with CCD stylesheet --> <!-- <?xml-stylesheet type='text/xsl' href='CCD.xsl'?> --> <!-- with CDA stylesheet --> <!-- with CDA stylesheet --> <!-- with CDA stylesheet --> <!-- with CDA stylesheet --> <!-- with CDA stylesheet --> <!-- with CDA stylesheet --> <?xml-stylesheet type='text/xsl' href='cda.xsl'?> <a/> and this stylesheet: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:template match="/*"> <line nr="{saxon:line-number(.)}" xmlns:saxon="http://saxon.sf.net/"/> </xsl:template> </xsl:stylesheet> and this command line: java -cp e:\javalib\xerces-2_9_1\xercesImpl.jar;e:\saxon-build\9.2.0.3\eej\saxon9ee.j ar net.sf.saxon.Transform -t -xsl:e:\temp\test.xsl -s:e:\temp\test.xml -t -l:on I get this output: Saxon-EE 9.2.0.3J from Saxonica Java version 1.6.0_15 Looking for saxon-license.lic at ..../saxon-license.lic Stylesheet compilation time: 499 milliseconds Processing file:/e:/temp/test.xml Using parser org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser Building tree for file:/e:/temp/test.xml using class net.sf.saxon.tinytree.TinyBuilder Tree built in 0 milliseconds Tree size: 12 nodes, 0 characters, 0 attributes Loading net.sf.saxon.event.MessageEmitter <?xml version="1.0" encoding="UTF-8"?><line xmlns:saxon="http://saxon.sf.net/" nr="11"/> Execution time: 47 milliseconds Memory used: 4887120 NamePool contents: 8 entries in 8 chains. 6 prefixes, 6 URIs which correctly shows the line number of the first element as 11. Please tell me what you get with this input, and/or show me similar input that demonstrates the failure. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: Swami Rajagopalan [mailto:swamigee_123@...] > Sent: 23 October 2009 19:40 > To: Mailing list for the SAXON XSLT and XQuery processor > Subject: Re: [saxon] Line numbers not correct > > I am using xercesImpl-2.8.1 > -Swami. > > > > ----- Original Message ---- > From: Michael Kay <mike@...> > To: Mailing list for the SAXON XSLT and XQuery processor > <saxon-help@...> > Sent: Fri, October 23, 2009 1:58:28 PM > Subject: Re: [saxon] Line numbers not correct > > > This sounds like a bug in the XML parser. Which XML parser > are you using? > > Regards, > > Michael Kay > http://www.saxonica.com/ > http://twitter.com/michaelhkay > > > -----Original Message----- > > From: Swami Rajagopalan [mailto:swamigee_123@...] > > Sent: 23 October 2009 18:00 > > To: Mailing list for the SAXON XSLT and XQuery processor > > Subject: Re: [saxon] Line numbers not correct > > > > Thanks Michael for the response. > > > > The line number difference matched with the number of comments. > > After I removed the comments and other lines the line numbers are > > exact e.g. > > <?xml version="1.0" encoding="utf-8"?> > > <!-- with CCD stylesheet --> > > <!-- <?xml-stylesheet type='text/xsl' href='CCD.xsl'?> --> > > <!-- with CDA stylesheet --> > > <?xml-stylesheet type='text/xsl' href='cda.xsl'?>. > > > > Is there any option to strip the comments? > > > > I use > > TransformerFactory tfactory = > > TransformerFactory.newInstance(); > > tfactory.setAttribute(FeatureKeys.LINE_NUMBERING, new > Boolean(true)); > > > > > > Thanks, > > Swami. > > > > > > > > ----- Original Message ---- > > From: Michael Kay <mike@...> > > To: Mailing list for the SAXON XSLT and XQuery processor > > <saxon-help@...> > > Sent: Thu, October 22, 2009 7:03:52 PM > > Subject: Re: [saxon] Line numbers not correct > > > > > > If you are using a SAX parser (which is the normal case), then the > > line number is that defined by the SAX specification. For > an element > > node, the line number is therefore the line containing the > ">" at the > > end of the start tag. For a node other than an element, the line > > number is that of the containing element. > > > > When you have an element with many attributes written one per line, > > the line number can certainly be out by a few lines from what you > > might expect. > > > > I can't quite see what you expect me to get from your > specimen code. > > All I can see is that the code fragment applies > saxon:line-number() to > > a variable called $node, whose declaration is not included in this > > code fragment. > > > > Regards, > > > > Michael Kay > > http://www.saxonica.com/ > > http://twitter.com/michaelhkay > > > > > -----Original Message----- > > > From: Swami Rajagopalan [mailto:swamigee_123@...] > > > Sent: 22 October 2009 23:07 > > > To: saxon-help@... > > > Subject: [saxon] Line numbers not correct > > > > > > Hi, > > > I am using saxon:line-number() to get the line numbers. > > > The context is in a different line number than the number > reported > > > by saxon:line-number(). > > > It differs by a few lines. > > > Trying to understand whether this one is acceptable or I am not > > > using this correctly. > > > Any help appreciated. > > > > > > Sample xsl that is applied. > > > > > > <xsl:template > > > match="*[cda:templateId/@root="2.16.840.1.113883.10.20.1.2 > > > 4"][ancestor::cda:section/cda:templateId/@root="2.16.8 > > > 40.1.113883.10.20.1.8"]" > > > priority="1001" > > > mode="M69"> > > > <svrl:fired-rule xmlns:saxon="http://saxon.sf.net/" > > > xmlns:svrl="http://purl.oclc.org/dsdl/svrl" > > > > > > context="*[cda:templateId/@root="2.16.840.1.113883.10.20.1 > > > .24"][ancestor::cda:section/cda:templateId/@root="2.16 > > > .840.1.113883.10.20.1.8"]"/> > > > > > > <!--ASSERT --> > > > <xsl:choose> > > > <xsl:when test="count(cda:statusCode)=1"/> > > > <xsl:otherwise> > > > <svrl:failed-assert > > > xmlns:saxon="http://saxon.sf.net/" > > > xmlns:svrl="http://purl.oclc.org/dsdl/svrl" > > > test="count(cda:statusCode)=1"> > > > <xsl:attribute name="location"> > > > <xsl:apply-templates select="." > > > mode="schematron-select-full-path"/> > > > </xsl:attribute> > > > <svrl:text><xsl:value-of > > > select="saxon:line-number($node)"/>-<xsl:text/>A > medication activity > > > SHOULD contain exactly one SubstanceAdministration / > > > statusCode.</svrl:text> > > > </svrl:failed-assert> > > > </xsl:otherwise> > > > </xsl:choose> > > > > > > Thanks, > > > Swami. > > > > > > > > > > > > > > > > > > -------------------------------------------------------------- > > > ---------------- > > > 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 > > > > > > -------------------------------------------------------------- > ---------------- > 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: Line numbers not correctGetting this output. No problem with saxon:line-number(.). This helped me to troubleshoot the actual problem.
XmlBeans removed those lines. Thanks again for the help. C:\Projects\saxonb>java -cp C:\Projects\lib\com.bea.core.apache.xercesImpl_2.8.1.jar;lib\saxon9 .jar net.sf.saxon.Transform -t -l:on -xsl:test.xsl -s:test.xml Saxon 9.1.0.6J from Saxonica Java version 1.5.0_11 Stylesheet compilation time: 641 milliseconds Processing file:/C:/Projects/saxonb/test.xml Building tree for file:/C:/Projects/saxonb/test.xml using class net.sf.saxon.tinytree.TinyBuilder Tree built in 15 milliseconds Tree size: 12 nodes, 0 characters, 0 attributes Loading net.sf.saxon.event.MessageEmitter <?xml version="1.0" encoding="UTF-8"?><line xmlns:saxon="http://saxon.sf.net/" nr="11"/>Execution ti me: 63 milliseconds Memory used: 784048 NamePool contents: 12 entries in 12 chains. 6 prefixes, 6 URIs -Swami. ----- Original Message ---- From: Michael Kay <mike@...> To: Mailing list for the SAXON XSLT and XQuery processor <saxon-help@...> Sent: Fri, October 23, 2009 2:53:15 PM Subject: Re: [saxon] Line numbers not correct I don't have 2.8.1 installed, but with 2.9.1 I get correct results. With this source document (test.xml) <?xml version="1.0" encoding="utf-8"?> <!-- with CCD stylesheet --> <!-- <?xml-stylesheet type='text/xsl' href='CCD.xsl'?> --> <!-- with CDA stylesheet --> <!-- with CDA stylesheet --> <!-- with CDA stylesheet --> <!-- with CDA stylesheet --> <!-- with CDA stylesheet --> <!-- with CDA stylesheet --> <?xml-stylesheet type='text/xsl' href='cda.xsl'?> <a/> and this stylesheet: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:template match="/*"> <line nr="{saxon:line-number(.)}" xmlns:saxon="http://saxon.sf.net/"/> </xsl:template> </xsl:stylesheet> and this command line: java -cp e:\javalib\xerces-2_9_1\xercesImpl.jar;e:\saxon-build\9.2.0.3\eej\saxon9ee.j ar net.sf.saxon.Transform -t -xsl:e:\temp\test.xsl -s:e:\temp\test.xml -t -l:on I get this output: Saxon-EE 9.2.0.3J from Saxonica Java version 1.6.0_15 Looking for saxon-license.lic at ..../saxon-license.lic Stylesheet compilation time: 499 milliseconds Processing file:/e:/temp/test.xml Using parser org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser Building tree for file:/e:/temp/test.xml using class net.sf.saxon.tinytree.TinyBuilder Tree built in 0 milliseconds Tree size: 12 nodes, 0 characters, 0 attributes Loading net.sf.saxon.event.MessageEmitter <?xml version="1.0" encoding="UTF-8"?><line xmlns:saxon="http://saxon.sf.net/" nr="11"/> Execution time: 47 milliseconds Memory used: 4887120 NamePool contents: 8 entries in 8 chains. 6 prefixes, 6 URIs which correctly shows the line number of the first element as 11. Please tell me what you get with this input, and/or show me similar input that demonstrates the failure. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: Swami Rajagopalan [mailto:swamigee_123@...] > Sent: 23 October 2009 19:40 > To: Mailing list for the SAXON XSLT and XQuery processor > Subject: Re: [saxon] Line numbers not correct > > I am using xercesImpl-2.8.1 > -Swami. > > > > ----- Original Message ---- > From: Michael Kay <mike@...> > To: Mailing list for the SAXON XSLT and XQuery processor > <saxon-help@...> > Sent: Fri, October 23, 2009 1:58:28 PM > Subject: Re: [saxon] Line numbers not correct > > > This sounds like a bug in the XML parser. Which XML parser > are you using? > > Regards, > > Michael Kay > http://www.saxonica.com/ > http://twitter.com/michaelhkay > > > -----Original Message----- > > From: Swami Rajagopalan [mailto:swamigee_123@...] > > Sent: 23 October 2009 18:00 > > To: Mailing list for the SAXON XSLT and XQuery processor > > Subject: Re: [saxon] Line numbers not correct > > > > Thanks Michael for the response. > > > > The line number difference matched with the number of comments. > > After I removed the comments and other lines the line numbers are > > exact e.g. > > <?xml version="1.0" encoding="utf-8"?> > > <!-- with CCD stylesheet --> > > <!-- <?xml-stylesheet type='text/xsl' href='CCD.xsl'?> --> > > <!-- with CDA stylesheet --> > > <?xml-stylesheet type='text/xsl' href='cda.xsl'?>. > > > > Is there any option to strip the comments? > > > > I use > > TransformerFactory tfactory = > > TransformerFactory.newInstance(); > > tfactory.setAttribute(FeatureKeys.LINE_NUMBERING, new > Boolean(true)); > > > > > > Thanks, > > Swami. > > > > > > > > ----- Original Message ---- > > From: Michael Kay <mike@...> > > To: Mailing list for the SAXON XSLT and XQuery processor > > <saxon-help@...> > > Sent: Thu, October 22, 2009 7:03:52 PM > > Subject: Re: [saxon] Line numbers not correct > > > > > > If you are using a SAX parser (which is the normal case), then the > > line number is that defined by the SAX specification. For > an element > > node, the line number is therefore the line containing the > ">" at the > > end of the start tag. For a node other than an element, the line > > number is that of the containing element. > > > > When you have an element with many attributes written one per line, > > the line number can certainly be out by a few lines from what you > > might expect. > > > > I can't quite see what you expect me to get from your > specimen code. > > All I can see is that the code fragment applies > saxon:line-number() to > > a variable called $node, whose declaration is not included in this > > code fragment. > > > > Regards, > > > > Michael Kay > > http://www.saxonica.com/ > > http://twitter.com/michaelhkay > > > > > -----Original Message----- > > > From: Swami Rajagopalan [mailto:swamigee_123@...] > > > Sent: 22 October 2009 23:07 > > > To: saxon-help@... > > > Subject: [saxon] Line numbers not correct > > > > > > Hi, > > > I am using saxon:line-number() to get the line numbers. > > > The context is in a different line number than the number > reported > > > by saxon:line-number(). > > > It differs by a few lines. > > > Trying to understand whether this one is acceptable or I am not > > > using this correctly. > > > Any help appreciated. > > > > > > Sample xsl that is applied. > > > > > > <xsl:template > > > match="*[cda:templateId/@root="2.16.840.1.113883.10.20.1.2 > > > 4"][ancestor::cda:section/cda:templateId/@root="2.16.8 > > > 40.1.113883.10.20.1.8"]" > > > priority="1001" > > > mode="M69"> > > > <svrl:fired-rule xmlns:saxon="http://saxon.sf.net/" > > > xmlns:svrl="http://purl.oclc.org/dsdl/svrl" > > > > > > context="*[cda:templateId/@root="2.16.840.1.113883.10.20.1 > > > .24"][ancestor::cda:section/cda:templateId/@root="2.16 > > > .840.1.113883.10.20.1.8"]"/> > > > > > > <!--ASSERT --> > > > <xsl:choose> > > > <xsl:when test="count(cda:statusCode)=1"/> > > > <xsl:otherwise> > > > <svrl:failed-assert > > > xmlns:saxon="http://saxon.sf.net/" > > > xmlns:svrl="http://purl.oclc.org/dsdl/svrl" > > > test="count(cda:statusCode)=1"> > > > <xsl:attribute name="location"> > > > <xsl:apply-templates select="." > > > mode="schematron-select-full-path"/> > > > </xsl:attribute> > > > <svrl:text><xsl:value-of > > > select="saxon:line-number($node)"/>-<xsl:text/>A > medication activity > > > SHOULD contain exactly one SubstanceAdministration / > > > statusCode.</svrl:text> > > > </svrl:failed-assert> > > > </xsl:otherwise> > > > </xsl:choose> > > > > > > Thanks, > > > Swami. > > > > > > > > > > > > > > > > > > -------------------------------------------------------------- > > > ---------------- > > > 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 > > > > > > -------------------------------------------------------------- > ---------------- > 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 |
| Free embeddable forum powered by Nabble | Forum Help |