Re: [xsl] Conditional Setting of a locale

Subject: Re: [xsl] Conditional Setting of a locale
From: Mark Anderson <mark.anderson@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 16 May 2008 14:05:42 +0100
Thanks Martin

So I'd have to do this everytime I format a number. Was hopign for a way to
set it once at the top of the file.

Regards

Mark


-----Original Message-----
From: xsl-list-digest-help@xxxxxxxxxxxxxxxxxxxxxx
[mailto:xsl-list-digest-help@xxxxxxxxxxxxxxxxxxxxxx]
Sent: Friday, May 16, 2008 12:10 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: xsl-list Digest 16 May 2008 05:10:00 -0000 Issue 1499

xsl-list Digest 16 May 2008 05:10:00 -0000 Issue 1499

Topics (messages 44614 through 44631):

onChange does not funtioning?
        44614 by: nenad.njconsulting.de
        44615 by: Michael Kay
        44616 by: Mukul Gandhi
        44627 by: nenad.njconsulting.de
        44630 by: XSL-List Owner
        44631 by: nenad.njconsulting.de

fo:block affects layout on previous page (remove column separators)
        44617 by: Per T?yr?
        44618 by: Eliot Kimber
        44620 by: Tony Graham
        44621 by: Tony Graham

<xsl:copy-of select="." /> removes (or converts) line breaks in text of child
nodes.
        44619 by: John Ericson
        44624 by: Martin Honnen
        44625 by: David Carlisle
        44626 by: John Ericson
        44628 by: John Ericson

Conditional Setting of a locale
        44622 by: Mark Anderson
        44623 by: Martin Honnen

AJAX question: Using <xsl:import> and document() function in Opera 9.2x 's
JavaScript API
        44629 by: ?????? ????????

Administrivia:

To subscribe to the digest, e-mail:
        <xsl-list-digest-subscribe@xxxxxxxxxxxxxxxxxxxxxx>

To unsubscribe from the digest, e-mail:
        <xsl-list-digest-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>

To post to the list, e-mail:
        <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>


----------------------------------------------------------------------
Date: Thu, 15 May 2008 12:32:49 +0200
To:  <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
From: nenad@xxxxxxxxxxxxxxx
Subject: onChange does not funtioning?
Message-Id: <7768353.23981210847569660.JavaMail.servlet@kundenserver>

Hi,
I have:

        <form action="Default.aspx"    runat="server">

<select name="SelectCategories">
                  <xsl:attribute
name="onChange">form.submit()</xsl:attribute>
                  <xsl:for-each
select="document('../content/en//categorycodes.xml')/catcodes/category">
                    <option>
                      <xsl:attribute name="value">
                        <xsl:value-of select="@code"/>
                      </xsl:attribute>

                      <xsl:value-of select="."/>
                    </option>
                  </xsl:for-each>
                </select>

</form>

onChange is not reacting.
Should I use javascript instead?
Thanks
Nenad

------------------------------

Date: Thu, 15 May 2008 11:55:41 +0100
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Subject: RE: [xsl] onChange does not funtioning?
Message-ID: <B9D60C256FF340A689297C51BAAB6C57@Sealion>

As far as XSLT is concerned, onChange is just an attribute to be added to
the generated HTML (or ASP) output document. It's no different from
generating an attribute called bgColor or fzSackTheLawyers. If the output
document doesn't behave the way you want, then you need to fix it. That
doesn't require a change in the way the document is generated.

Or perhaps you are imagining that somehow the onChange action should be
activated during the XSLT transformation? If so, you're confused about the
processing model.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: nenad@xxxxxxxxxxxxxxx [mailto:nenad@xxxxxxxxxxxxxxx]
> Sent: 15 May 2008 11:33
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] onChange does not funtioning?
>
> Hi,
> I have:
>
>         <form action="Default.aspx"    runat="server">
>
>
> <select name="SelectCategories">
>                   <xsl:attribute
> name="onChange">form.submit()</xsl:attribute>
>                   <xsl:for-each
> select="document('../content/en//categorycodes.xml')/catcodes/
> category">
>                     <option>
>                       <xsl:attribute name="value">
>                         <xsl:value-of select="@code"/>
>                       </xsl:attribute>
>
>                       <xsl:value-of select="."/>
>                     </option>
>                   </xsl:for-each>
>                 </select>
>
>
>
> </form>
>
> onChange is not reacting.
> Should I use javascript instead?
> Thanks
> Nenad
>

------------------------------

Date: Thu, 15 May 2008 16:42:29 +0530
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Subject: Re: [xsl] onChange does not funtioning?
Message-ID: <7870f82e0805150412x50fee77chba075011cf2b6a9@xxxxxxxxxxxxxx>

It seems, you are generating wrong value of onChange attribute (which
cannot trigger a form submit).

I think, you need to do:
<xsl:attribute name="onChange">document.forms[0].submit()</xsl:attribute>
(if there is a single form in the page)

or,

<xsl:attribute name="onChange">document.formName.submit()</xsl:attribute>
(if you know the form by name)

Your problem does not seem at the XSLT level. It seems to be at the HTML
level.

On 5/15/08, nenad@xxxxxxxxxxxxxxx <nenad@xxxxxxxxxxxxxxx> wrote:
> Hi,
> I have:
>
>        <form action="Default.aspx"    runat="server">
>
>
> <select name="SelectCategories">
>                  <xsl:attribute
name="onChange">form.submit()</xsl:attribute>
>                  <xsl:for-each
select="document('../content/en//categorycodes.xml')/catcodes/category">
>                    <option>
>                      <xsl:attribute name="value">
>                        <xsl:value-of select="@code"/>
>                      </xsl:attribute>
>
>                      <xsl:value-of select="."/>
>                    </option>
>                  </xsl:for-each>
>                </select>
>
>
>
> </form>
>
> onChange is not reacting.
> Should I use javascript instead?
> Thanks
> Nenad

--
Regards,
Mukul Gandhi

------------------------------

Date: Thu, 15 May 2008 20:51:24 +0200
To:  <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
From: nenad@xxxxxxxxxxxxxxx
Subject: Re: [xsl] onChange does not funtioning?
Message-Id: <25869072.151171210877484432.JavaMail.servlet@kundenserver>

Mikul,

OK, I guess problem is there because I do conditional transformation like

when paramexample > 0
   <form action="Default.aspx"    runat="server">
...
Here I display  content
</form>

when paramexample2 = 0

   <form action="Default.aspx"    runat="server">
...
Here I display  content
</form>

else
<form action="Default.aspx"    runat="server">
...
Here I display  content
</form>

so I guess it is unknown which form.
I also tried with name or id attributes but no changes

----- Original Message -----

It seems, you are generating wrong value of onChange attribute (which
cannot trigger a form submit).

I think, you need to do:
<xsl:attribute name="onChange">document.forms[0].submit()</xsl:attribute>
(if there is a single form in the page)

or,

<xsl:attribute name="onChange">document.formName.submit()</xsl:attribute>
(if you know the form by name)

Your problem does not seem at the XSLT level. It seems to be at the HTML
level.

On 5/15/08, nenad@xxxxxxxxxxxxxxx <nenad@xxxxxxxxxxxxxxx> wrote:
> Hi,
> I have:
>
>        <form action="Default.aspx"    runat="server">
>
>
> <select name="SelectCategories">
>                  <xsl:attribute
name="onChange">form.submit()</xsl:attribute>
>                  <xsl:for-each
select="document('../content/en//categorycodes.xml')/catcodes/category">
>                    <option>
>                      <xsl:attribute name="value">
>                        <xsl:value-of select="@code"/>
>                      </xsl:attribute>
>
>                      <xsl:value-of select="."/>
>                    </option>
>                  </xsl:for-each>
>                </select>
>
>
>
> </form>
>
> onChange is not reacting.
> Should I use javascript instead?
> Thanks
> Nenad

--
Regards,
Mukul Gandhi

------------------------------

Date: Thu, 15 May 2008 18:21:54 -0400
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
From: XSL-List Owner <xsl-list-owner@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [xsl] onChange does not funtioning?
Message-Id: <a06240815c452670a78fa@[192.168.1.47]>

It does not seem to me that this is a question about XSL; it seems to
be a question about the design of data that might be created using
XSLT.

Discussion of what your target data should contain (for example, what
should be on and HTML page to achieve the desired effect in a
browser) is out of scope for XSL-List. Once you know what you want
the target of your transform to contain, we on XSL-List will be happy
to help you with the XSLT to create it.

-- Tommie
--

======================================================================
B. Tommie Usdin                        mailto:btusdin@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                           Phone: 301/315-9631
Suite 207                                    Direct Line: 301/315-9634
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
   Mulberry Technologies: A Consultancy Specializing in XML and SGML
======================================================================

------------------------------

Date: Fri, 16 May 2008 01:56:47 +0200
To:  <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
From: nenad@xxxxxxxxxxxxxxx
Subject: Re: [xsl] onChange does not funtioning?
Message-Id: <1216410.181781210895807109.JavaMail.servlet@kundenserver>

Sorry if I am wrong but just put things simpler.
The same code in html or pure ASP.net functioning 100%

I just had to write in xslt way and after page transformation
function is disabled. I can not find anywhere else cause
but I am ready to obey to rules and scope of this list.

It does not seem to me that this is a question about XSL; it seems to
be a question about the design of data that might be created using
XSLT.

Discussion of what your target data should contain (for example, what
should be on and HTML page to achieve the desired effect in a
browser) is out of scope for XSL-List. Once you know what you want
the target of your transform to contain, we on XSL-List will be happy
to help you with the XSLT to create it.

-- Tommie
--

======================================================================
B. Tommie Usdin                        mailto:btusdin@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                           Phone: 301/315-9631
Suite 207                                    Direct Line: 301/315-9634
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
   Mulberry Technologies: A Consultancy Specializing in XML and SGML
======================================================================

------------------------------

Date: Thu, 15 May 2008 13:27:26 +0200
To: "XSL List" <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
From: =?ISO-8859-1?Q?Per_T=F6yr=E4?= <per.toyra@xxxxxx>
Subject: fo:block affects layout on previous page (remove column separators)
Message-ID: <482C1E1E.20804@xxxxxx>

Hello XSL-List,

I'm creating a three column layout with column separators in the gutter.
This is achived with one background image on `region-body`. This works
as intended on all pages but creates problems on pages with page-wide
objects (span=all) which do not cover the whole page.  In my case, I
have a lot of  page-wide tables with footnotes.

In the space between the page-wide table and the footnote the column
separators is showing while I'd like it not to.

I have solved this (partly) by adding a `fo:block` (with
background-color set to white) wrapping the table and added

    <xsl:attribute name="space-before">3mm</xsl:attribute>
    <xsl:attribute name="space-after.optimum">3mm</xsl:attribute>
    <xsl:attribute name="space-after">110mm</xsl:attribute>
    <xsl:attribute name="space-after.precedence">5</xsl:attribute>
    <xsl:attribute name="space-before.precedence">15</xsl:attribute>

to the table attribute-set. This solution works everywhere except on the
last table who's not followed by another table but by a fo:block with a
title. This title however is located on the next page but still creates
a space between the footnote and the fo:block (containing the table).
How is this possible? Am I doing something fundamentaly wrong here? When
I remove all data following the last table, everything works like a charm.

In my world, a element shouldn't be able to affect the layout on a
previous page, but I'm a newbie at this FO-stuff too... If someone got a
better solution to the problem I'd be thrilled to hear about it!

What I really want is the column separators in the gutter to disappear
between the table and footnote if there isn't any column-wide content in
this area. Is this possible to achive?

Btw, I'm using Antennahouse XSLFormatter 4.2.

Any ideas are appreciated!

Thanks in advance.
Per T?yr?

------------------------------

Date: Thu, 15 May 2008 08:53:18 -0500
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
From: Eliot Kimber <ekimber@xxxxxxxxxxxx>
Subject: Re: [xsl] fo:block affects layout on previous page (remove column
 separators)
Message-ID: <C451AA7E.2F56%ekimber@xxxxxxxxxxxx>

On 5/15/08 6:27 AM, "Per T=F6yr=E4" <per.toyra@xxxxxx> wrote:

> Btw, I'm using Antennahouse XSLFormatter 4.2.
>=20
> Any ideas are appreciated!

Use the Antenna House extension for column rules.

Cheers,

Eliot

--=20
Eliot Kimber
Senior Solutions Architect
"Bringing Strategy, Content, and Technology Together"
Main: 610.631.6770
www.reallysi.com
www.rsuitecms.com

------------------------------

Date: Thu, 15 May 2008 16:01:41 +0100
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
From: Tony Graham <Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [xsl] fo:block affects layout on previous page (remove column
separators)
Message-ID: <87r6c3obl6.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxx>

On Thu, May 15 2008 12:27:26 +0100, per.toyra@xxxxxx wrote:
> I'm creating a three column layout with column separators in the
> gutter. This is achived with one background image on
> region-body`. This works as intended on all pages but creates problems
> on pages with page-wide objects (span=all) which do not cover the
> whole page.  In my case, I  have a lot of  page-wide tables with
> footnotes.
...
> In my world, a element shouldn't be able to affect the layout on a
> previous page, but I'm a newbie at this FO-stuff too... If someone got
> a better solution to the problem I'd be thrilled to hear about it!

It's hard to say what to expect without seeing a fragment at least of
your FO.  Is there a fo:block or some other element that contains both
the last table and the following fo:block?

Provided it satisfies the constraints in the XSL spec, how the formatter
implements the spec is up to its implementer.  If you find a bug in the
implementation, then you can take it up with the vendor.  If you find a
bug in the spec, then you can report it at xsl-editors@xxxxxxx  If
there's something you want to see in the next version of XSL, you can
check the requirements document at http://www.w3.org/TR/xslfo20-req/ and
provide feedback.

> What I really want is the column separators in the gutter to disappear
> between the table and footnote if there isn't any column-wide content
> in this area. Is this possible to achive?
>
> Btw, I'm using Antennahouse XSLFormatter 4.2.

Antenna House has extensions [1] for column rules that may do just what
you want.

Regards,

Tony Graham                         Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx
Director                                  W3C XSL FO SG Invited Expert
Menteith Consulting Ltd
XML, XSL and XSLT consulting, programming and training
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
Registered in Ireland - No. 428599   http://www.menteithconsulting.com
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
xmlroff XSL Formatter                               http://xmlroff.org
xslide Emacs mode                  http://www.menteith.com/wiki/xslide
Unicode: A Primer                               urn:isbn:0-7645-4625-2

[1] http://www.antennahouse.com/xslfo/axf4-extension.htm#column-rule

------------------------------

Date: Thu, 15 May 2008 15:55:08 +0100
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
From: Tony Graham <Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [xsl] fo:block affects layout on previous page (remove column
separators)
Message-ID: <87skwjobw3.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxx>

On Thu, May 15 2008 12:27:26 +0100, per.toyra@xxxxxx wrote:
> I'm creating a three column layout with column separators in the
> gutter. This is achived with one background image on
> region-body`. This works as intended on all pages but creates problems
> on pages with page-wide objects (span=all) which do not cover the
> whole page.  In my case, I  have a lot of  page-wide tables with
> footnotes.
...
> In my world, a element shouldn't be able to affect the layout on a
> previous page, but I'm a newbie at this FO-stuff too... If someone got
> a better solution to the problem I'd be thrilled to hear about it!

It's hard to say what to expect without seeing a fragment at least of
your FO.  Is there a fo:block or some other element that contains both
the last table and the following fo:block?

Provided it satisfies the constraints in the XSL spec, how the formatter
implements the spec is up to its implementer.  If you find a bug in the
implementation, then you can take it up with the vendor.  If you find a
bug in the spec, then you can report it at xsl-editors@xxxxxxx  If
there's something you want to see in the next version of XSL, you can
check the requirements document at http://www.w3.org/TR/xslfo20-req/ and
provide feedback.

> What I really want is the column separators in the gutter to disappear
> between the table and footnote if there isn't any column-wide content
> in this area. Is this possible to achive?
>
> Btw, I'm using Antennahouse XSLFormatter 4.2.

Antenna House has extensions [1] for column rules that may do just what
you want.

Regards,

Tony Graham                         Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx
Director                                  W3C XSL FO SG Invited Expert
Menteith Consulting Ltd
XML, XSL and XSLT consulting, programming and training
Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
Registered in Ireland - No. 428599   http://www.menteithconsulting.com
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
xmlroff XSL Formatter                               http://xmlroff.org
xslide Emacs mode                  http://www.menteith.com/wiki/xslide
Unicode: A Primer                               urn:isbn:0-7645-4625-2

[1] http://www.antennahouse.com/xslfo/axf4-extension.htm#column-rule

------------------------------

Date: Thu, 15 May 2008 16:28:44 +0200
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
From: "John Ericson" <john.ericson@xxxxxxxx>
Subject: <xsl:copy-of select="." /> removes (or converts) line breaks in text
of child nodes.
Message-ID: <FA32CB8C795940878F3DA833FF658447@johnsnotebook>

Hi,

My problem is that my new xml-files produced by XSL removes the line breaks
from the text in my <field name="content">....</field> nodes when I use a
<xsl:copy-of select="." />. The thing is, my original xml file is produced
by mysqldump. It looks fine but in <field name="content">....</field> the
exported text has line breaks characters at the end of each line. These are
marked ^M in vim btw, and is some kind of extra line break that mysql
requires. It looks something like this:

-----
                <field name="content">{* DEFAULT FORM LAYOUT / pure CSS *}^M
^M
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;
width=&quot;100%&quot; border=&quot;0&quot;&gt;^M
&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;^M
^M
&lt;p&gt;^M
[..]
-----

Now when I XSL transform this file to new files I use <xsl:copy-of
select="." /> to export the whole structure as a couple of nodes above the
field nodes. Everything exports fine except this text that is slightly
changed. The special line breaks have been converted into empty lines. The
output looks like this:

-----
                          <field name="value">{* DEFAULT FORM LAYOUT / pure
CSS *}

&lt;table cellspacing="0" cellpadding="0" width="100%" border="0"&gt;

&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;

&lt;p&gt;
 -----

I need a way to retain the mystic ^M characters because without these I
won't get line break when I import the xml in mysql.

The structure of the original xml-file looks like this:

-----
<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
<database name="sssb">
        <table_structure name="cms_content">
                <field Field="content_id" Type="int(11)" Null="NO" Key="PRI"
Default=""
Extra="" />
                [..]
        </table_structure>
        <table_data name="cms_content">
        <row>
                <field name="content_id">779</field>
                <field name="content_name">Anm?f??l skadedjur</field>
                [..]
        </row>
        <row>
                <field name="content_id">780</field>
                [..]
        </row>
        </table_data>
        <table_structure name="cms_content_props">
                <field Field="content_id" Type="int(11)" Null="YES" Key="MUL"
Extra="" />
                [..]
        </table_structure>
        <table_data name="cms_content_props">
        <row>
                <field name="content_id">780</field>
                [..]
        </row>
        </table_data>
        [..]
</database>
</mysqldump>
-----
I used "[..]" signs to note that I cut the file on these places.

My XSL-file looks like this:

-----
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        version="2.0">

<xsl:output method="text" />
<xsl:output method="xml" indent="yes" name="xml" />

<xsl:template match="/">

<!-- If node is table_structure copy it to new file -->
<xsl:for-each select="//table_structure">
        <xsl:variable name="filename" select="concat('tables/',@name,'.xml')"
/>
        <xsl:value-of select="$filename" />  <!-- Creating  -->
        <xsl:result-document href="{$filename}" format="xml">
                <mysqldump
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
                        <database name="sssb">

                                <xsl:copy-of select="." />

                                <!-- Pick one table_data node after -->
                                <xsl:copy-of
select="following-sibling::table_data[1]" />
                        </database>
                </mysqldump>
        </xsl:result-document>
</xsl:for-each>

</xsl:template>
</xsl:stylesheet>
-----

I use Saxon 9.0.0.4N to XSL transform. Thanks for reading!

--
John Ericson, Fast2
Web: http://www.fast2.se

------------------------------

Date: Thu, 15 May 2008 18:00:08 +0200
To:  xsl-list@xxxxxxxxxxxxxxxxxxxxxx
From: Martin Honnen <Martin.Honnen@xxxxxx>
Subject: Re: [xsl] <xsl:copy-of select="." /> removes (or converts) line
breaks
 in text of child nodes.
Message-ID: <482C5E08.4070400@xxxxxx>

John Ericson wrote:

I think you are encountering line break normalization the XML parser does.

> I use Saxon 9.0.0.4N to XSL transform. Thanks for reading!

Do you use Saxon .NET from the command line? Or do you use the .NET API?
In the latter case you might be able to avoid the normalization by
passing in an XmlTextReader with Normalization set to false to the
DocumentBuilder.Build method.

--

        Martin Honnen
        http://JavaScript.FAQTs.com/

------------------------------

Date: Thu, 15 May 2008 17:11:27 +0100
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
From: David Carlisle <davidc@xxxxxxxxx>
Subject: Re: [xsl] <xsl:copy-of select="." /> removes (or converts) line
breaks in text of child nodes.
Message-Id: <200805151611.m4FGBRT4031993@xxxxxxxxxxxxxxxxxxx>

> My problem is that my new xml-files produced by XSL removes the line breaks
> from the text in my <field name="content">....</field> nodes when I use a
> <xsl:copy-of select="." />.

the information that you have ^M^J (MSDOS) linebreaks is gone before
XSLT even starts, the XML XML spec mandates that an XML parser
normalises any of ^M, ^M^J and ^J to a  ^J (#10) character.

Similar;y when serialising, a system can outbreak line ends in any of
these forms, although it seems most just use ^J always.

If your later application needs dos line ends it may be simplest just to
run something like unix2dos over the generated file.

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________

------------------------------

Date: Thu, 15 May 2008 20:14:28 +0200
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
From: "John Ericson" <john.ericson@xxxxxxxx>
Subject: Re: [xsl] <xsl:copy-of select="." /> removes (or converts) line
breaks in text of child nodes.
Message-ID: <F78760C6740F4519826DEBD952A5BFDB@johnsnotebook>

--------------------------------------------------
From: "Martin Honnen" <Martin.Honnen@xxxxxx>
Sent: Thursday, May 15, 2008 6:00 PM
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [xsl] <xsl:copy-of select="." /> removes (or converts) line
breaks in text of child nodes.

>
> I think you are encountering line break normalization the XML parser does.
>
>> I use Saxon 9.0.0.4N to XSL transform. Thanks for reading!
>
> Do you use Saxon .NET from the command line? Or do you use the .NET API?
> In the latter case you might be able to avoid the normalization by passing
> in an XmlTextReader with Normalization set to false to the
> DocumentBuilder.Build method.
>

I use the command line version.

--
John Ericson, Fast2
Web: http://www.fast2.se

------------------------------

Date: Thu, 15 May 2008 21:02:19 +0200
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
From: "John Ericson" <john.ericson@xxxxxxxx>
Subject: Re: [xsl] <xsl:copy-of select="." /> removes (or converts) line
breaks in text of child nodes.
Message-ID: <1F9B8EC8B3EB44B9A4F792A7272D3EC1@johnsnotebook>

--------------------------------------------------
From: "David Carlisle"
Sent: Thursday, May 15, 2008 6:11 PM

>
>
>> My problem is that my new xml-files produced by XSL removes the line
>> breaks
>> from the text in my <field name="content">....</field> nodes when I use a
>> <xsl:copy-of select="." />.
>
> the information that you have ^M^J (MSDOS) linebreaks is gone before
> XSLT even starts, the XML XML spec mandates that an XML parser
> normalises any of ^M, ^M^J and ^J to a  ^J (#10) character.
>
> Similar;y when serialising, a system can outbreak line ends in any of
> these forms, although it seems most just use ^J always.
>
> If your later application needs dos line ends it may be simplest just to
> run something like unix2dos over the generated file.
>
> David

I tried that but unfortunately it didn't do the trick. When I was at it I
also tried to manually insert ^M chars in vim and load the file in mysql but
that didn't help either. I tried changing the file to more appear like
another working one but still couldn't get it to load with line breaks.

It seems mysql is very picky with the files it wants to load.

--
John Ericson, Fast2
Web: http://www.fast2.se

------------------------------

Date: Thu, 15 May 2008 18:00:33 +0100
To: "xsl-list@xxxxxxxxxxxxxxxxxxxxxx" <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
From: Mark Anderson <mark.anderson@xxxxxxxxxxxxxxxxxxx>
Subject: Conditional Setting of a locale
Message-ID:
<659A61939DBDE044A110BDA8D92304716EE359171D@xxxxxxxxxxxxxxxxxxxxx>

Hi All

I'm stuck with decimal formatting in my XSL stylesheet (XSLT 1.0 only).

My users are based in UK (so locale is en-GB), but they need to output docu=
ments with figures in Euro's, US$ and GBP. The latter two are no problem, b=
ut I can't figure out a way to change the decimal format for documents bein=
g sent to Europe.

I have an XML element called <currency> that tells me the target currency. =
Conceptually, I want to do this:

<xsl:choose>
        <xsl:when test=3D"currency =3D 'Euro'">
        <xsl:decimal-format name=3D"standard" decimal-separator=3D"," group=
ing-separator=3D"."/>
            <xsl:variable name=3D"number" select=3D"#.,00"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:decimal-format name=3D"standard" decimal-separator=3D"." g=
rouping-separator=3D","/>
            <xsl:variable name=3D"number" select=3D"#,.00"/>
        </xsl:otherwise>
</xsl:choose>

Unfortunately, it's not possible as xsl:decimal-format needs to be at the t=
op level and xsl:choose, etc. must be in the template body.

So, is there a way to set the decimal format based on the content of the XM=
L with all docs being generated in an single locale?

I'd like to extend this to date formatting too if possible.

TIA

Mark

------------------------------

Date: Thu, 15 May 2008 19:19:13 +0200
To:  xsl-list@xxxxxxxxxxxxxxxxxxxxxx
From: Martin Honnen <Martin.Honnen@xxxxxx>
Subject: Re: [xsl] Conditional Setting of a locale
Message-ID: <482C7091.9010705@xxxxxx>

Mark Anderson wrote:

> So, is there a way to set the decimal format based on the content of
> the XML with all docs being generated in an single locale?

You need to define two decimal formats e.g.
   <xsl:decimal-format
     name="d1"
     decimal-separator="."
     grouping-separator=","/>

   <xsl:decimal-format
     name="d2"
     decimal-separator=","
     grouping-separator="."/>

then your code can choose e.g.
    <xsl:choose>
      <xsl:when test="Currency = 'Euro'">
        <xsl:value-of select="format-number(foo, '0.00', 'd2')"/>
      </xsl:choose>
      <xsl:otherwise>
        <xsl:value-of select="format-number(foo, '0.00'., 'd1')"/>
      </xsl:otherwise>
    </xsl:choose>

--

        Martin Honnen
        http://JavaScript.FAQTs.com/

------------------------------

Date: Fri, 16 May 2008 01:51:19 +0400
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
From: "=?KOI8-R?B?7cnIwcnMIPvF09TBy8/X?=" <mike.shestakov@xxxxxxxxx>
Subject: AJAX question: Using <xsl:import> and document() function in Opera
9.2x 's JavaScript API
Message-ID: <a08e239b0805151451n6e8f92f4gd8c21dfed1c6a6e6@xxxxxxxxxxxxxx>

Look at this:
http://sizov.ryit.ru/
Table is supposed to come up like it does in IE5.5+ and FF1.0+ and
Opera 9.5. Unfortunately it fails in Opera 9.2 which is used by 15% of
my visitors;(

Here is what's going on:

1) Library (http://sizov.ryit.ru/js/sjax.js - 2KB) sends a request for
an XML-file (http://sizov.ryit.ru/xml/daily.xml).
2) After that library analyses XML, detects the stylesheet that should
be used, and sends another request for XSL

As you can see in Firefox or IE, the right column represents time in
minutes + seconds. Originally time comes in XML from server in seconds
and I use a template to convert it in min+sec format. Template is
located into another stylesheet.
(http://sizov.ryit.ru//xsl/service.xsl)

Firefox handles <xsl:import> and <xsl:include> by default. MSIE with
MSXML6 needs two extra lines of code to allow that

freethreaded_xml.resolveExternals=true;
freethreaded_xml.setProperty('AllowDocumentFunction',true);

Opera 9.x and Safari3 work with xsl transformations using my library,
but when it comes to importing external stylesheets, they fail.

Does anyone know how to make Opera load external XSL and XML? Maybe
there are some special switches?...

This is a trivial example and here it would be much easier to include
the template to the stylesheet and not to use <xsl:import>. But I need
a solution for something different, much more complicated. Example
above is just easiest way to illustrate the essence of my question.

Any help is greatly appreciated! Thanks!

------------------------------

End of xsl-list Digest
***********************************

Current Thread