|
View:
New views
13 Messages
—
Rating Filter:
Alert me
|
|
|
-u option behaves differently for net.sf.saxon.Query than net.sf.saxon.TransformHi,
With saxon 9.1.0.1, I am trying to use a custom URIResolver with a custom parser for net.sf.saxon.Transform. The logic to resolve particular filename extensions was pretty tricky to get right under net.sf.saxon.Transform, and perhaps its related to that. But when I use the -u option with net.sf.saxon.Query, I get a NPE when used with -s:filename on the command line. If I leave off -u, doc('fname') call inside the query works, but the resolver is not used by the command line (SXXP0003: Error reported by XML parser: Content is not allowed in prolog.) I've just started to play around with net.sf.saxon.Query, so I can't say that this is new behaviour or anything like that, just different from net.sf.saxon.Transform. Cheers, Peter ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
replace functionOne solution to replace '\n' with <br/>? (without a template)
example: (wrong) <xsl:variable name="BR"><![CDATA[<br/>]]></xsl:variable> <xsl:value-of disable-output-escaping="yes" select="replace(.,'\n',$BR,'s')"/> note: the output is xml (for xhtml) It´s mandatory to use a recursive template? ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: replace function> One solution to replace '\n' with <br/>? (without a template)
<xsl:analyze-string select="whatever" regex="\n"> <xsl:matching-substring><br/></xsl:matching-substring> <xsl:non-matching-substring> <xsl:value-of select="."/> </xsl:non-matching-substring> </xsl:analyze-string> -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/ ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: replace functionOr
<xsl:value-of select="replace(.,'\\n','<br/>')"/> ----------------------------------------------- Ryan Puddephatt FIX Developer Fidessa LatentZero 1 Alfred Place London WC1E 7EB Office: +44 (0) 20 7462 4200 Direct: +44 (0) 20 7323 6112 Blackberry: +44 (0) 79 8539 2458 Fax: +44 (0) 20 7462 4242 Email: rpuddephatt@... Web: http://www.latentzero.com -----Original Message----- From: saxon-help-bounces@... [mailto:saxon-help-bounces@...] On Behalf Of Andrew Welch Sent: 08 July 2008 14:33 To: Mailing list for the SAXON XSLT and XQuery processor Subject: Re: [saxon] replace function > One solution to replace '\n' with <br/>? (without a template) <xsl:analyze-string select="whatever" regex="\n"> <xsl:matching-substring><br/></xsl:matching-substring> <xsl:non-matching-substring> <xsl:value-of select="."/> </xsl:non-matching-substring> </xsl:analyze-string> -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/ ------------------------------------------------------------------------ - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ _______________________________________________________________________ The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. _____________________________________________________________________ This e-mail has been scanned for viruses by Verizon Business Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.mci.com ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: replace functionGeneral questions about XSLT coding are best asked on the xsl-list at
mulberrytech.com. This list should be used only for questions that are specific to the Saxon implementation. You can do this task easily in XSLT 2.0 using <xsl:analyze-string select="$in" regex="\n"> <xsl:matching-string><br/></xsl:matching-string> <xsl:non-matching-string><xsl:value-of select="."/></xsl:non-matching-string> </xsl:analyze-string> Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: saxon-help-bounces@... > [mailto:saxon-help-bounces@...] On Behalf > Of Jose Antonio Illescas Del Olmo > Sent: 08 July 2008 14:28 > To: Mailing list for the SAXON XSLT and XQuery processor > Subject: [saxon] replace function > > One solution to replace '\n' with <br/>? (without a template) > > example: (wrong) > > <xsl:variable name="BR"><![CDATA[<br/>]]></xsl:variable> > <xsl:value-of disable-output-escaping="yes" > select="replace(.,'\n',$BR,'s')"/> > > note: the output is xml (for xhtml) > > It´s mandatory to use a recursive template? > > -------------------------------------------------------------- > ----------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source > project, along with a healthy diet, reduces your potential > for chronic lameness and boredom. Vote Now at > http://www.sourceforge.net/community/cca08 > _______________________________________________ > saxon-help mailing list archived at > http://saxon.markmail.org/ saxon-help@... > https://lists.sourceforge.net/lists/listinfo/saxon-help ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: replace function2008/7/8 Ryan Puddephatt <rpuddephatt@...>:
> Or > > <xsl:value-of select="replace(.,'\\n','<br/>')"/> no, you can't do that... - the select attribute cannot contain an unescaped lt < - even if you escaped it, you wouldn't want to insert the string <br/> into the result, you want to add a <br/> element (if you did insert that string, that's what you would get in the output, so you would literally see the 5 characters "<br/>" in the rendered html) Always remember you are constructing a tree of nodes by adding nodes - element nodes, text nodes etc When that tree gets serialized then you get <br/> because the "br" node has no children... -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/ ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: replace functionWorks fine!
Thank you Andrew Welch wrote: >> One solution to replace '\n' with <br/>? (without a template) >> > > > <xsl:analyze-string select="whatever" regex="\n"> > <xsl:matching-substring><br/></xsl:matching-substring> > <xsl:non-matching-substring> > <xsl:value-of select="."/> > </xsl:non-matching-substring> > </xsl:analyze-string> > > > > ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: replace functionAh yes, good point my bad :-(
----------------------------------------------- Ryan Puddephatt FIX Developer Fidessa LatentZero 1 Alfred Place London WC1E 7EB Office: +44 (0) 20 7462 4200 Direct: +44 (0) 20 7323 6112 Blackberry: +44 (0) 79 8539 2458 Fax: +44 (0) 20 7462 4242 Email: rpuddephatt@... Web: http://www.latentzero.com -----Original Message----- From: saxon-help-bounces@... [mailto:saxon-help-bounces@...] On Behalf Of Andrew Welch Sent: 08 July 2008 14:50 To: Mailing list for the SAXON XSLT and XQuery processor Subject: Re: [saxon] replace function 2008/7/8 Ryan Puddephatt <rpuddephatt@...>: > Or > > <xsl:value-of select="replace(.,'\\n','<br/>')"/> no, you can't do that... - the select attribute cannot contain an unescaped lt < - even if you escaped it, you wouldn't want to insert the string <br/> into the result, you want to add a <br/> element (if you did insert that string, that's what you would get in the output, so you would literally see the 5 characters "<br/>" in the rendered html) Always remember you are constructing a tree of nodes by adding nodes - element nodes, text nodes etc When that tree gets serialized then you get <br/> because the "br" node has no children... -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/ ------------------------------------------------------------------------ - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ _______________________________________________________________________ The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. _____________________________________________________________________ This e-mail has been scanned for viruses by Verizon Business Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.mci.com ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: replace functionWorks fine!
I asked my (future) questions about XSLT at mulberrytech.com. Thank you Michael Kay wrote: > General questions about XSLT coding are best asked on the xsl-list at > mulberrytech.com. This list should be used only for questions that are > specific to the Saxon implementation. > > You can do this task easily in XSLT 2.0 using > > <xsl:analyze-string select="$in" regex="\n"> > <xsl:matching-string><br/></xsl:matching-string> > <xsl:non-matching-string><xsl:value-of > select="."/></xsl:non-matching-string> > </xsl:analyze-string> > > Michael Kay > http://www.saxonica.com/ > > > >> -----Original Message----- >> From: saxon-help-bounces@... >> [mailto:saxon-help-bounces@...] On Behalf >> Of Jose Antonio Illescas Del Olmo >> Sent: 08 July 2008 14:28 >> To: Mailing list for the SAXON XSLT and XQuery processor >> Subject: [saxon] replace function >> >> One solution to replace '\n' with <br/>? (without a template) >> >> example: (wrong) >> >> <xsl:variable name="BR"><![CDATA[<br/>]]></xsl:variable> >> <xsl:value-of disable-output-escaping="yes" >> select="replace(.,'\n',$BR,'s')"/> >> >> note: the output is xml (for xhtml) >> >> It´s mandatory to use a recursive template? >> >> -------------------------------------------------------------- >> ----------- >> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! >> Studies have shown that voting for your favorite open source >> project, along with a healthy diet, reduces your potential >> for chronic lameness and boredom. Vote Now at >> http://www.sourceforge.net/community/cca08 >> _______________________________________________ >> saxon-help mailing list archived at >> http://saxon.markmail.org/ saxon-help@... >> https://lists.sourceforge.net/lists/listinfo/saxon-help >> > > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > saxon-help mailing list archived at http://saxon.markmail.org/ > saxon-help@... > https://lists.sourceforge.net/lists/listinfo/saxon-help > > ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: -u option behaves differently for net.sf.saxon.Query thannet.sf.saxon.TransformThanks for reporting the NPE problem with the -u option. This is present in
both 9.0 and 9.1 and I've patched both - see https://sourceforge.net/tracker/index.php?func=detail&aid=2013712&group_id=2 9872&atid=397617 To force the URIResolver to be used to resolve the filename used in the -s: option, try using a filename that starts "http:" or "file:", which should have the same effect as the -u flag, but don't affect the query filename, which is where the NPE is occurring. Alternatively, supply a ModuleURIResolver using the -mr option - you can use the standard one which is net.sf.saxon.query.StandardModuleURIResolver. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: saxon-help-bounces@... > [mailto:saxon-help-bounces@...] On Behalf > Of Peter Rushforth > Sent: 08 July 2008 10:55 > To: Mailing list for the SAXON XSLT and XQuery processor > Subject: [saxon] -u option behaves differently for > net.sf.saxon.Query thannet.sf.saxon.Transform > > Hi, > > With saxon 9.1.0.1, I am trying to use a custom URIResolver > with a custom parser for net.sf.saxon.Transform. > > The logic to resolve particular filename extensions was > pretty tricky to get right under net.sf.saxon.Transform, and > perhaps its related to that. > > But when I use the -u option with net.sf.saxon.Query, I get a > NPE when used with -s:filename on the command line. If I > leave off -u, doc('fname') call inside the query works, but > the resolver is not used by the command line (SXXP0003: Error > reported by XML parser: Content is not allowed in prolog.) > > I've just started to play around with net.sf.saxon.Query, so > I can't say that this is new behaviour or anything like that, > just different from net.sf.saxon.Transform. > > Cheers, > Peter > > -------------------------------------------------------------- > ----------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source > project, along with a healthy diet, reduces your potential > for chronic lameness and boredom. Vote Now at > http://www.sourceforge.net/community/cca08 > _______________________________________________ > saxon-help mailing list archived at > http://saxon.markmail.org/ saxon-help@... > https://lists.sourceforge.net/lists/listinfo/saxon-help ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
saxon <xsl:analize-string> error?
XML
<root>XSL <xsl:analize-string select="/root/text" regex=".*(\\{[\w]+\\}).*">I want this output Parametrized text amount=123But Saxon throws this error (why?) XPTY0020: Cannot select a node here: the context is an atomic value ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: saxon <xsl:analize-string> error?Four
errors
here.
Firstly, the regex attribute is an attribute value
template, so any curly braces need to be doubled. Instead you seem to have
doubled the backslash, which isn't necessary. I think it should
be
regex=".*(\{{[\w]+\}}).*"
Secondly (and this is the actual error message): within
<xsl:matching-substring> the context item is the string that was matched
(the matching substring). This means that you can't use a path expression that
selects relative to the context node, because there is no context
node. This includes an expression starting with "/", because "/" means
"the root of the document that contains the context node". You need to bind a
variable outside the analyze-string, and use a path expression starting
with this variable
<xsl:variable name="root"
select="/">
<xsl:analyze-string...
<xsl:value-of
select="$root/root/params..."
Thirdly, your regex expression matches the entire
content of <text>, so the <matching-substring> instruction will only
be invoked once. Fourthly, it's a greedy match, so it will swallow everything
from the first open-curly to the last close-curly. I think you want to invoke it
once for each thing between curly braces, which would
be
<xsl:analize-string select="/root/text"
regex="\{{[\w]+?\}}">
<xsl:matching-substring><xsl:value-of select="$root/root/params/*[name()=current()]"</xsl:matching-substring> Also please note, this list is for problems
specific to the Saxon product. General XSLT coding questions are better sent to
the xsl-list at mulberrytech.com
Michael Kay
XML ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: saxon <xsl:analize-string> error?Hi Jose,
Your error is a general Recommendation specified error. Questions about general XSLT can best be asked on the xsl list at Mulberry Tech. (however I understand it is sometimes non-trivial to know whether something is XSLT related or Saxon specific). The reason for your error is that you are inside xsl:analyze-string (note the "y") and that inside it the context is set to an atomic value (the result of your regular expression). One solution is setting a variable before the xsl:analyze-string that points to the node you want to access. Also note that your regular expression will not give the desired effect. Escaping a backslash is not needed, there's no interpolation like in C-style strings here. Cheers, -- Abel -- Jose Antonio Illescas Del Olmo wrote: > XML > > <root> > <text>Parametrized text {name}={abc}</text> > <params> > <name>amount</name> > <abc>123</abc> > </params> > </root> > > XSL > > <xsl:analize-string select="/root/text" regex=".*(\\{[\w]+\\}).*"> > <xsl:matching-substring><xsl:value-of > select="/root/params/*[name()=regex.group(1)]"</xsl:matching-substring> > > I want this output > > Parametrized text amount=123 > > But Saxon throws this error (why?) > > XPTY0020: Cannot select a node here: the context is an atomic value > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > ------------------------------------------------------------------------ > > _______________________________________________ > saxon-help mailing list archived at http://saxon.markmail.org/ > saxon-help@... > https://lists.sourceforge.net/lists/listinfo/saxon-help ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
| Free Forum Powered by Nabble | Forum Help |