Re: [xsl] toknize() not working with saxon9

Subject: Re: [xsl] toknize() not working with saxon9
From: a kusa <akusa8@xxxxxxxxx>
Date: Mon, 15 Mar 2010 15:49:35 -0500
How are you running Saxon? - I did mention in the reply that I run it
from the command line. Maybe I should have been more clear. Sorry
about that.  So I use java -jar saxon9.jar -s:source -o:output
-xsl:test.xsl, where the source is a directory of XML files. Please
see my replies below.

 * which version - SAxon 9.1
 * on which platform - windows 2000
 * from the command line or an application - Command line
 * if from an application, show us the application code - N/A
 * via which API - N/A
 * with what option settings? - java -jar saxon9.jar -s:source
-o:output -xsl:test.xsl,

I did try printing static-base-uri(). staic-base-uri() gave me the
path that my xsl program was located.

When I run the same program on a single XML file,
unparsed-entity-uri() works jsut fine. But when I run it in a batch
mode, it returns an empty string.



On Mon, Mar 15, 2010 at 3:33 PM, Houghton,Andrew <houghtoa@xxxxxxxx> wrote:
>> From: a kusa [mailto:akusa8@xxxxxxxxx]
>> Sent: Monday, March 15, 2010 04:27 PM
>> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>> Subject: Re: [xsl] toknize() not working with saxon9
>>
>> Can you please elaborate on your statement?
>
> Are you running your transform from the command line:
>
> java -jar ...
>
> or is your transform being run by another application, that you wrote or
someone else wrote, and if so what is the name of that open/closed source
application.
>
> In addition, are you using java's XML parser or Xerces and which version of
Java or Xerces are you using.
>
> These sort of clues help others figure out what might be wrong rather than
making a blanket statement that tokenize() doesn't work in Saxon9 since it
seems, to me, to be working just fine in all my transforms.
>
> Andy.
>
>
>> On Mon, Mar 15, 2010 at 2:42 PM, Michael Kay <mike@xxxxxxxxxxxx> wrote:
>> >>
>> >> You are right. I tried printing the value of  temp1 and it was
>> blank.
>> >> So unparsed-entity-uri() is the culprit. But how do I get
>> >> around this problem?
>> >
>> > Start by answering the question implied in my previous response:
>> >
>> > (you don't say anything about how you are running Saxon or which XML
>> parser
>> > you are using)
>> >
>> > Regards,
>> >
>> > Michael Kay
>> > http://www.saxonica.com/
>> > http://twitter.com/michaelhkay
>> >
>> >>
>> >> On Fri, Mar 12, 2010 at 5:17 PM, Michael Kay
>> >> <mike@xxxxxxxxxxxx> wrote:
>> >> >
>> >> > Start by seeing what the value of $temp1 is with both
>> >> processors. Also
>> >> > try showing the value of static-base-uri() in both cases.
>> >> >
>> >> > Since your System ID is a relative URI, the chances are it has
>> >> > something to do with the way the relative URI is expanded
>> >> to an absolute URI.
>> >> >
>> >> > Certainly the problem is much more likely to be with
>> >> > unparsed-entity-uri() than with tokenize(), since the former is
>> >> > inherently far more dependent on your system environment. Some XML
>> >> > parsers don't even report the information that Saxon needs for
>> this
>> >> > function (you don't say anything about how you are running
>> >> Saxon or which XML parser you are using).
>> >> >
>> >> > Regards,
>> >> >
>> >> > Michael Kay
>> >> > http://www.saxonica.com/
>> >> > http://twitter.com/michaelhkay
>> >> >
>> >> >
>> >> >> -----Original Message-----
>> >> >> From: a kusa [mailto:akusa8@xxxxxxxxx]
>> >> >> Sent: 12 March 2010 21:50
>> >> >> To: xsl-list
>> >> >> Subject: [xsl] toknize() not working with saxon9
>> >> >>
>> >> >> Hi
>> >> >>
>> >> >> I am trying to use tokenize() to grab the name of an entity.
>> >> >>
>> >> >> Here is my input XML:
>> >> >>
>> >> >> <!DOCTYPE test [
>> >> >> <!ENTITY g1 SYSTEM "123-g1.tif" NDATA CCITT4>]> <test>
>> >> >>
>> >> >>
>> >> >> <image id="g1" res="34" inbr="g1"/>
>> >> >> </test>
>> >> >>
>> >> >> Here is my XSL snippet:
>> >> >>
>> >> >> <xsl:template match="image">
>> >> >>
>> >> >>       <xsl:variable name="temp1"
>> >> >> select="unparsed-entity-uri(@inbr)"/>
>> >> >> <xsl:variable name="temp2" select="tokenize($temp1,
>> '/')[last()]"/>
>> >> >>       <graphic>
>> >> >>                       <xsl:attribute
>> >> >> name="href"><xsl:value-of select="$temp2"/></xsl:attribute>
>> >> >>                       <xsl:attribute name="id" select="@id"/>
>> >> >> </graphic>
>> >> >>
>> >> >> </xsl:template>
>> >> >>
>> >> >> When I run this on an individual file in XML Spy, I get
>> >> the value of
>> >> >> cariable temp2 as '123-g1.tif'. But when I run this using
>> >> saxon, it
>> >> >> is empty.
>> >> >>
>> >> >> Can anyone help point out what is the issue here?
>> >> >>
>> >> >> Thanks in advance.

Current Thread