Discussion:
[FO] Background image on whole page
Kamal Bhatt
2008-01-08 06:55:59 UTC
Permalink
Hi,
In XSL FO, is it possible to put a background image on the whole page
without errors about overlapping content?

Thanks.
--
Kamal Bhatt


--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
G. Ken Holman
2008-01-08 18:51:18 UTC
Permalink
Post by Kamal Bhatt
In XSL FO, is it possible to put a background image on the whole
page without errors about overlapping content?
Each region can have its own background, so you can use
background-image= on <region-body>.

To get "the whole page" you will need to have the body region extend
to the page dimensions, which is not really desirable for top and
bottom margins. An alternative is to parcel out a whole page
background into bits that are set as the backgrounds of the
respective perimeter regions and body region.

I hope this helps.

. . . . . . . . . . . Ken

--
Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds: publicly-available developer resources and training
G. Ken Holman mailto:***@CraneSoftwrights.com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Kamal Bhatt
2008-01-09 21:00:17 UTC
Permalink
Post by G. Ken Holman
Each region can have its own background, so you can use
background-image= on <region-body>.
To get "the whole page" you will need to have the body region extend
to the page dimensions, which is not really desirable for top and
bottom margins.
Yes, I noticed.
Post by G. Ken Holman
An alternative is to parcel out a whole page background into bits that
are set as the backgrounds of the respective perimeter regions and
body region.
<sigh> I was hoping you wouldn't say that. Oh well. I guess I will chalk
that up as something else XSLFO can't do.

Thanks.
--
Kamal Bhatt


--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Vincent Hennebert
2008-01-10 11:34:01 UTC
Permalink
Post by Kamal Bhatt
Post by G. Ken Holman
Each region can have its own background, so you can use
background-image= on <region-body>.
To get "the whole page" you will need to have the body region extend
to the page dimensions, which is not really desirable for top and
bottom margins.
Yes, I noticed.
Post by G. Ken Holman
An alternative is to parcel out a whole page background into bits
that are set as the backgrounds of the respective perimeter regions
and body region.
<sigh> I was hoping you wouldn't say that. Oh well. I guess I will chalk
that up as something else XSLFO can't do.
Well you can also use an absolutely positioned block-container with
a background-image; for example:
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="page"
page-height="29.7cm" page-width="21cm"
margin-top="2cm" margin-bottom="2cm"
margin-left="3cm" margin-right="3cm">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="page">
<fo:flow flow-name="xsl-region-body">
<fo:block-container absolute-position="absolute"
top="-2cm" left="-3cm" width="21cm" height="29.7cm"
background-image="path/to/the/image.png">
<fo:block/>
</fo:block-container>
<fo:block>
The document starts here...
...
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>

HTH,
Vincent


--
Vincent Hennebert Anyware Technologies
http://people.apache.org/~vhennebert http://www.anyware-tech.com
Apache FOP Committer FOP Development/Consulting


--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
G. Ken Holman
2008-01-10 13:20:08 UTC
Permalink
Post by Vincent Hennebert
Post by Kamal Bhatt
Post by G. Ken Holman
Each region can have its own background, so you can use
background-image= on <region-body>.
To get "the whole page" you will need to have the body region extend
to the page dimensions, which is not really desirable for top and
bottom margins.
Yes, I noticed.
Post by G. Ken Holman
An alternative is to parcel out a whole page background into bits
that are set as the backgrounds of the respective perimeter regions
and body region.
<sigh> I was hoping you wouldn't say that. Oh well. I guess I will chalk
that up as something else XSLFO can't do.
Well you can also use an absolutely positioned block-container with
Considering section 4.9.6 of the specification, I'm not confident
this is guaranteed to work as desired by the original poster.
Post by Vincent Hennebert
<fo:page-sequence master-reference="page">
<fo:flow flow-name="xsl-region-body">
<fo:block-container absolute-position="absolute"
top="-2cm" left="-3cm" width="21cm" height="29.7cm"
background-image="path/to/the/image.png">
<fo:block/>
</fo:block-container>
Perhaps adding z-index="-1" to the above will change the stacking
layer sufficiently that the following blocks are not in conflict ...
but your example of putting this a the start of the flow means that
the background image is only going to be on the first page and not on
every page.

If you then make the decision to move the specification of the
absolutely-positioned block container to one of the perimeter areas
and static content, so that it appears on every page, there may still
be a problem: someone on the committee told me that there is no
guarantee that the unspecified z-index of a perimeter region is less
than the unspecified z-index of the body region.

Perhaps a combination of the block-container, in a perimeter region,
with a lower z-index than the content of the body region (which
7.30.18 implies is zero) would do the trick. I'd appreciate it if
someone on the committee would comment on this.

. . . . . . . . . . . . . . . Ken

--
Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds: publicly-available developer resources and training
G. Ken Holman mailto:***@CraneSoftwrights.com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Signature House
2008-01-10 16:56:58 UTC
Permalink
Document Function Befuddlement

I'm working on an application where I have to periodically run a number of xml files that I'm given through the same xsl transform.
Conveniently, I also get another xml file that lists the names of all of the data files, so this seemed like the perfect chance to
put the document function to good use (my first time).

I'm on a PC running XP SP2, using IE 7 & xsl 1.0. Below I've included a much reduced test process that I've been using to get it
working - it simply lists the position, name and value of all element nodes.

'day1.xml' & 'day2.xml' are the data files, 'monthly list.xml' is the list of file names and I use 'list nodes.xml' to trigger the
whole thing by loading it into IE.

My befuddlement comes in because I'm getting more output from a more restrictive selection criteria than I am from a less
restrictive selection criteria.


If, in 'monthly process.xsl', I use

<xsl:for-each select="document($monthly_link/@link)/daily//*">

I get, correctly:

Pos Name Value
--- ---- -----
1 client
2 day 1
3 name John
4 client
5 day 2
6 name Margaret


However, this doesn't show the daily nodes, which I wanted included also, so I tried:

<xsl:for-each select="document($monthly_link/@link)//*">

I get, unexpectedly:

Pos Name Value
--- ---- -----
1 daily
2 client
3 day 1
4 name John


What I expected (and wanted) from the use of //* is:

Pos Name Value
--- ---- -----
1 daily
2 client
3 day 1
4 name John
5 daily
6 client
7 day 2
8 name Margaret


Would someone please explain why this is happening and what I should do to get the results I need?

Thanks in advance

Mike McBee
Signature House




monthly process.xsl
-------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<table border="1">
<xsl:variable name="monthly_link" select="document('monthly list.xml')/monthly/day"/>
<tr><td>Pos</td><td>Name</td><td>Value</td></tr>
<xsl:for-each select="SEE ABOVE">
<tr>
<td><xsl:number value="position()" format="1"/></td>
<td><xsl:value-of select="name(self::node())"/></td>
<td><xsl:value-of select="normalize-space(text())"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>


list nodes.xml
--------------
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="monthly process.xsl"?>
<null>null</null>


monthly list.xml
----------------
<?xml version="1.0"?>
<monthly>
<day link="day1.xml"/>
<day link="day2.xml"/>
</monthly>


day1.xml
--------
<?xml version="1.0"?>
<daily>
<client>
<day>1</day>
<name>John</name>
</client>
</daily>


day2.xml
--------
<?xml version="1.0"?>
<daily>
<client>
<day>2</day>
<name>Margaret</name>
</client>
</daily>





--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Scott Trenda
2008-01-10 17:02:48 UTC
Permalink
I'm... not too sure about the genuine fix for the problem, but this
might be an acceptable workaround:

<xsl:for-each
select="document($monthly_link/@link)/daily/descendant-or-self::*">

~ Scott


-----Original Message-----
From: Signature House [mailto:***@signaturehouse.net]
Sent: Thursday, January 10, 2008 10:57 AM
To: xsl-***@lists.mulberrytech.com
Subject: [xsl] Document Function Befuddlement

Document Function Befuddlement

I'm working on an application where I have to periodically run a number
of xml files that I'm given through the same xsl transform.
Conveniently, I also get another xml file that lists the names of all of
the data files, so this seemed like the perfect chance to
put the document function to good use (my first time).

I'm on a PC running XP SP2, using IE 7 & xsl 1.0. Below I've included a
much reduced test process that I've been using to get it
working - it simply lists the position, name and value of all element
nodes.

'day1.xml' & 'day2.xml' are the data files, 'monthly list.xml' is the
list of file names and I use 'list nodes.xml' to trigger the
whole thing by loading it into IE.

My befuddlement comes in because I'm getting more output from a more
restrictive selection criteria than I am from a less
restrictive selection criteria.


If, in 'monthly process.xsl', I use

<xsl:for-each select="document($monthly_link/@link)/daily//*">

I get, correctly:

Pos Name Value
--- ---- -----
1 client
2 day 1
3 name John
4 client
5 day 2
6 name Margaret


However, this doesn't show the daily nodes, which I wanted included
also, so I tried:

<xsl:for-each select="document($monthly_link/@link)//*">

I get, unexpectedly:

Pos Name Value
--- ---- -----
1 daily
2 client
3 day 1
4 name John


What I expected (and wanted) from the use of //* is:

Pos Name Value
--- ---- -----
1 daily
2 client
3 day 1
4 name John
5 daily
6 client
7 day 2
8 name Margaret


Would someone please explain why this is happening and what I should do
to get the results I need?

Thanks in advance

Mike McBee
Signature House




monthly process.xsl
-------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<table border="1">
<xsl:variable name="monthly_link" select="document('monthly
list.xml')/monthly/day"/>
<tr><td>Pos</td><td>Name</td><td>Value</td></tr>
<xsl:for-each select="SEE ABOVE">
<tr>
<td><xsl:number value="position()" format="1"/></td>
<td><xsl:value-of select="name(self::node())"/></td>
<td><xsl:value-of select="normalize-space(text())"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>


list nodes.xml
--------------
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="monthly process.xsl"?>
<null>null</null>


monthly list.xml
----------------
<?xml version="1.0"?>
<monthly>
<day link="day1.xml"/>
<day link="day2.xml"/>
</monthly>


day1.xml
--------
<?xml version="1.0"?>
<daily>
<client>
<day>1</day>
<name>John</name>
</client>
</daily>


day2.xml
--------
<?xml version="1.0"?>
<daily>
<client>
<day>2</day>
<name>Margaret</name>
</client>
</daily>





--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Signature House
2008-01-10 18:40:04 UTC
Permalink
Scott

Thanks, that works, but it just makes the whole thing weirder.

I also tried:

<xsl:for-each select="document($monthly_link/@link)/descendant-or-self::*">

but got the same results as before, only the first file came thru and it added some blank lines:

Pos Name Value
--- ----
1
2 daily
3 client
4 day 1
5
6 name John
7

I'd really like to get rid of having to specify the /daily so I could use it as a generic utility - just change the name of the file
with the list of file names and run this against it. Also, this wouldn't work if the input files didn't all have the same structure.

I'll take Michael Kay's advice and try another processor.

Anyone have any suggestions for a 1.0 processor that'll run under Windows XP (cheap or free)?

Thanks

Mike McBee
Signature House
***@signaturehouse.net
www.signaturehouse.net
304-842-3386

-> -----Original Message-----
-> From: Scott Trenda [mailto:***@oati.net]
-> Sent: Thursday, January 10, 2008 12:03 PM
-> To: xsl-***@lists.mulberrytech.com
-> Subject: RE: [xsl] Document Function Befuddlement
->
->
-> I'm... not too sure about the genuine fix for the problem, but this
-> might be an acceptable workaround:
->
-> <xsl:for-each
-> select="document($monthly_link/@link)/daily/descendant-or-self::*">
->
-> ~ Scott
->
->
-> -----Original Message-----
-> From: Signature House [mailto:***@signaturehouse.net]
-> Sent: Thursday, January 10, 2008 10:57 AM
-> To: xsl-***@lists.mulberrytech.com
-> Subject: [xsl] Document Function Befuddlement
->
-> Document Function Befuddlement
->
-> I'm working on an application where I have to periodically run a number
-> of xml files that I'm given through the same xsl transform.
-> Conveniently, I also get another xml file that lists the names of all of
-> the data files, so this seemed like the perfect chance to
-> put the document function to good use (my first time).
->
-> I'm on a PC running XP SP2, using IE 7 & xsl 1.0. Below I've included a
-> much reduced test process that I've been using to get it
-> working - it simply lists the position, name and value of all element
-> nodes.
->
-> 'day1.xml' & 'day2.xml' are the data files, 'monthly list.xml' is the
-> list of file names and I use 'list nodes.xml' to trigger the
-> whole thing by loading it into IE.
->
-> My befuddlement comes in because I'm getting more output from a more
-> restrictive selection criteria than I am from a less
-> restrictive selection criteria.
->
->
-> If, in 'monthly process.xsl', I use
->
-> <xsl:for-each select="document($monthly_link/@link)/daily//*">
->
-> I get, correctly:
->
-> Pos Name Value
-> --- ---- -----
-> 1 client
-> 2 day 1
-> 3 name John
-> 4 client
-> 5 day 2
-> 6 name Margaret
->
->
-> However, this doesn't show the daily nodes, which I wanted included
-> also, so I tried:
->
-> <xsl:for-each select="document($monthly_link/@link)//*">
->
-> I get, unexpectedly:
->
-> Pos Name Value
-> --- ---- -----
-> 1 daily
-> 2 client
-> 3 day 1
-> 4 name John
->
->
-> What I expected (and wanted) from the use of //* is:
->
-> Pos Name Value
-> --- ---- -----
-> 1 daily
-> 2 client
-> 3 day 1
-> 4 name John
-> 5 daily
-> 6 client
-> 7 day 2
-> 8 name Margaret
->
->
-> Would someone please explain why this is happening and what I should do
-> to get the results I need?
->
-> Thanks in advance
->
-> Mike McBee
-> Signature House
->
->
->
->
-> monthly process.xsl
-> -------------------
-> <?xml version="1.0"?>
-> <xsl:stylesheet version="1.0"
-> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-> <xsl:template match="/">
-> <table border="1">
-> <xsl:variable name="monthly_link" select="document('monthly
-> list.xml')/monthly/day"/>
-> <tr><td>Pos</td><td>Name</td><td>Value</td></tr>
-> <xsl:for-each select="SEE ABOVE">
-> <tr>
-> <td><xsl:number value="position()" format="1"/></td>
-> <td><xsl:value-of select="name(self::node())"/></td>
-> <td><xsl:value-of select="normalize-space(text())"/></td>
-> </tr>
-> </xsl:for-each>
-> </table>
-> </xsl:template>
-> </xsl:stylesheet>
->
->
-> list nodes.xml
-> --------------
-> <?xml version="1.0"?>
-> <?xml-stylesheet type="text/xsl" href="monthly process.xsl"?>
-> <null>null</null>
->
->
-> monthly list.xml
-> ----------------
-> <?xml version="1.0"?>
-> <monthly>
-> <day link="day1.xml"/>
-> <day link="day2.xml"/>
-> </monthly>
->
->
-> day1.xml
-> --------
-> <?xml version="1.0"?>
-> <daily>
-> <client>
-> <day>1</day>
-> <name>John</name>
-> </client>
-> </daily>
->
->
-> day2.xml
-> --------
-> <?xml version="1.0"?>
-> <daily>
-> <client>
-> <day>2</day>
-> <name>Margaret</name>
-> </client>
-> </daily>
->
->
->
->
->
-> --~------------------------------------------------------------------
-> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
-> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
-> or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
-> --~--
->
->
-> --~------------------------------------------------------------------
-> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
-> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
-> or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
-> --~--
->
->
->



--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Scott Trenda
2008-01-10 18:53:09 UTC
Permalink
Well, the second one makes sense; descendant-or-self::* also selects
root nodes, and each new document has a root node. Also, your stylesheet
would probably be more easily debugged by using these in the <for-each>:

<td><xsl:number/></td>
<td><xsl:value-of select="name()"/></td>
<td><xsl:value-of select="normalize-space()"/></td>

That'll give you the position in the source document (instead of the
position in the context node-set), the name of the context node,
whatever it may be (avoid any self:: restriction confusion here), and
the native string-value of the node. Perhaps then it'll be clear as to
what exactly the processor is computing.


IE uses MSXML, which is generally solid and standard-compliant. libxslt
(xsltproc) is a good, free processor that is generally as dependable as
MSXML. I believe the latest version of Apple's Safari for Windows uses
libxslt; it's the only built-in libxslt implementation I know of in
Windows. (aside from XML IDEs, of course.)

~ Scott


-----Original Message-----
From: Signature House [mailto:***@signaturehouse.net]
Sent: Thursday, January 10, 2008 12:40 PM
To: xsl-***@lists.mulberrytech.com
Subject: RE: [xsl] Document Function Befuddlement

Scott

Thanks, that works, but it just makes the whole thing weirder.

I also tried:

<xsl:for-each
select="document($monthly_link/@link)/descendant-or-self::*">

but got the same results as before, only the first file came thru and it
added some blank lines:

Pos Name Value
--- ----
1
2 daily
3 client
4 day 1
5
6 name John
7

I'd really like to get rid of having to specify the /daily so I could
use it as a generic utility - just change the name of the file
with the list of file names and run this against it. Also, this wouldn't
work if the input files didn't all have the same structure.

I'll take Michael Kay's advice and try another processor.

Anyone have any suggestions for a 1.0 processor that'll run under
Windows XP (cheap or free)?

Thanks

Mike McBee
Signature House
***@signaturehouse.net
www.signaturehouse.net
304-842-3386

-> -----Original Message-----
-> From: Scott Trenda [mailto:***@oati.net]
-> Sent: Thursday, January 10, 2008 12:03 PM
-> To: xsl-***@lists.mulberrytech.com
-> Subject: RE: [xsl] Document Function Befuddlement
->
->
-> I'm... not too sure about the genuine fix for the problem, but this
-> might be an acceptable workaround:
->
-> <xsl:for-each
-> select="document($monthly_link/@link)/daily/descendant-or-self::*">
->
-> ~ Scott
->
->
-> -----Original Message-----
-> From: Signature House [mailto:***@signaturehouse.net]
-> Sent: Thursday, January 10, 2008 10:57 AM
-> To: xsl-***@lists.mulberrytech.com
-> Subject: [xsl] Document Function Befuddlement
->
-> Document Function Befuddlement
->
-> I'm working on an application where I have to periodically run a
number
-> of xml files that I'm given through the same xsl transform.
-> Conveniently, I also get another xml file that lists the names of all
of
-> the data files, so this seemed like the perfect chance to
-> put the document function to good use (my first time).
->
-> I'm on a PC running XP SP2, using IE 7 & xsl 1.0. Below I've included
a
-> much reduced test process that I've been using to get it
-> working - it simply lists the position, name and value of all element
-> nodes.
->
-> 'day1.xml' & 'day2.xml' are the data files, 'monthly list.xml' is the
-> list of file names and I use 'list nodes.xml' to trigger the
-> whole thing by loading it into IE.
->
-> My befuddlement comes in because I'm getting more output from a more
-> restrictive selection criteria than I am from a less
-> restrictive selection criteria.
->
->
-> If, in 'monthly process.xsl', I use
->
-> <xsl:for-each select="document($monthly_link/@link)/daily//*">
->
-> I get, correctly:
->
-> Pos Name Value
-> --- ---- -----
-> 1 client
-> 2 day 1
-> 3 name John
-> 4 client
-> 5 day 2
-> 6 name Margaret
->
->
-> However, this doesn't show the daily nodes, which I wanted included
-> also, so I tried:
->
-> <xsl:for-each select="document($monthly_link/@link)//*">
->
-> I get, unexpectedly:
->
-> Pos Name Value
-> --- ---- -----
-> 1 daily
-> 2 client
-> 3 day 1
-> 4 name John
->
->
-> What I expected (and wanted) from the use of //* is:
->
-> Pos Name Value
-> --- ---- -----
-> 1 daily
-> 2 client
-> 3 day 1
-> 4 name John
-> 5 daily
-> 6 client
-> 7 day 2
-> 8 name Margaret
->
->
-> Would someone please explain why this is happening and what I should
do
-> to get the results I need?
->
-> Thanks in advance
->
-> Mike McBee
-> Signature House
->
->
->
->
-> monthly process.xsl
-> -------------------
-> <?xml version="1.0"?>
-> <xsl:stylesheet version="1.0"
-> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-> <xsl:template match="/">
-> <table border="1">
-> <xsl:variable name="monthly_link" select="document('monthly
-> list.xml')/monthly/day"/>
-> <tr><td>Pos</td><td>Name</td><td>Value</td></tr>
-> <xsl:for-each select="SEE ABOVE">
-> <tr>
-> <td><xsl:number value="position()" format="1"/></td>
-> <td><xsl:value-of select="name(self::node())"/></td>
-> <td><xsl:value-of select="normalize-space(text())"/></td>
-> </tr>
-> </xsl:for-each>
-> </table>
-> </xsl:template>
-> </xsl:stylesheet>
->
->
-> list nodes.xml
-> --------------
-> <?xml version="1.0"?>
-> <?xml-stylesheet type="text/xsl" href="monthly process.xsl"?>
-> <null>null</null>
->
->
-> monthly list.xml
-> ----------------
-> <?xml version="1.0"?>
-> <monthly>
-> <day link="day1.xml"/>
-> <day link="day2.xml"/>
-> </monthly>
->
->
-> day1.xml
-> --------
-> <?xml version="1.0"?>
-> <daily>
-> <client>
-> <day>1</day>
-> <name>John</name>
-> </client>
-> </daily>
->
->
-> day2.xml
-> --------
-> <?xml version="1.0"?>
-> <daily>
-> <client>
-> <day>2</day>
-> <name>Margaret</name>
-> </client>
-> </daily>
->
->
->
->
->
-> --~------------------------------------------------------------------
-> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
-> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
-> or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
-> --~--
->
->
-> --~------------------------------------------------------------------
-> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
-> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
-> or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
-> --~--
->
->
->



--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
W Charlton
2008-01-11 09:38:12 UTC
Permalink
Assuming you are using JavaScript to process the transform, could you show
your JavaScript or a link to the page you are testing on?

It is possible that there is a problem there.


William Charlton
The yMonda team
yMonda Limited
w: www.ymonda.net


-----Original Message-----
From: Scott Trenda [mailto:***@oati.net]
Sent: 2008 January 10 18:53
To: xsl-***@lists.mulberrytech.com
Subject: RE: [xsl] Document Function Befuddlement

Well, the second one makes sense; descendant-or-self::* also selects
root nodes, and each new document has a root node. Also, your stylesheet
would probably be more easily debugged by using these in the <for-each>:

<td><xsl:number/></td>
<td><xsl:value-of select="name()"/></td>
<td><xsl:value-of select="normalize-space()"/></td>

That'll give you the position in the source document (instead of the
position in the context node-set), the name of the context node,
whatever it may be (avoid any self:: restriction confusion here), and
the native string-value of the node. Perhaps then it'll be clear as to
what exactly the processor is computing.


IE uses MSXML, which is generally solid and standard-compliant. libxslt
(xsltproc) is a good, free processor that is generally as dependable as
MSXML. I believe the latest version of Apple's Safari for Windows uses
libxslt; it's the only built-in libxslt implementation I know of in
Windows. (aside from XML IDEs, of course.)

~ Scott


-----Original Message-----
From: Signature House [mailto:***@signaturehouse.net]
Sent: Thursday, January 10, 2008 12:40 PM
To: xsl-***@lists.mulberrytech.com
Subject: RE: [xsl] Document Function Befuddlement

Scott

Thanks, that works, but it just makes the whole thing weirder.

I also tried:

<xsl:for-each
select="document($monthly_link/@link)/descendant-or-self::*">

but got the same results as before, only the first file came thru and it
added some blank lines:

Pos Name Value
--- ----
1
2 daily
3 client
4 day 1
5
6 name John
7

I'd really like to get rid of having to specify the /daily so I could
use it as a generic utility - just change the name of the file
with the list of file names and run this against it. Also, this wouldn't
work if the input files didn't all have the same structure.

I'll take Michael Kay's advice and try another processor.

Anyone have any suggestions for a 1.0 processor that'll run under
Windows XP (cheap or free)?

Thanks

Mike McBee
Signature House
***@signaturehouse.net
www.signaturehouse.net
304-842-3386

-> -----Original Message-----
-> From: Scott Trenda [mailto:***@oati.net]
-> Sent: Thursday, January 10, 2008 12:03 PM
-> To: xsl-***@lists.mulberrytech.com
-> Subject: RE: [xsl] Document Function Befuddlement
->
->
-> I'm... not too sure about the genuine fix for the problem, but this
-> might be an acceptable workaround:
->
-> <xsl:for-each
-> select="document($monthly_link/@link)/daily/descendant-or-self::*">
->
-> ~ Scott
->
->
-> -----Original Message-----
-> From: Signature House [mailto:***@signaturehouse.net]
-> Sent: Thursday, January 10, 2008 10:57 AM
-> To: xsl-***@lists.mulberrytech.com
-> Subject: [xsl] Document Function Befuddlement
->
-> Document Function Befuddlement
->
-> I'm working on an application where I have to periodically run a
number
-> of xml files that I'm given through the same xsl transform.
-> Conveniently, I also get another xml file that lists the names of all
of
-> the data files, so this seemed like the perfect chance to
-> put the document function to good use (my first time).
->
-> I'm on a PC running XP SP2, using IE 7 & xsl 1.0. Below I've included
a
-> much reduced test process that I've been using to get it
-> working - it simply lists the position, name and value of all element
-> nodes.
->
-> 'day1.xml' & 'day2.xml' are the data files, 'monthly list.xml' is the
-> list of file names and I use 'list nodes.xml' to trigger the
-> whole thing by loading it into IE.
->
-> My befuddlement comes in because I'm getting more output from a more
-> restrictive selection criteria than I am from a less
-> restrictive selection criteria.
->
->
-> If, in 'monthly process.xsl', I use
->
-> <xsl:for-each select="document($monthly_link/@link)/daily//*">
->
-> I get, correctly:
->
-> Pos Name Value
-> --- ---- -----
-> 1 client
-> 2 day 1
-> 3 name John
-> 4 client
-> 5 day 2
-> 6 name Margaret
->
->
-> However, this doesn't show the daily nodes, which I wanted included
-> also, so I tried:
->
-> <xsl:for-each select="document($monthly_link/@link)//*">
->
-> I get, unexpectedly:
->
-> Pos Name Value
-> --- ---- -----
-> 1 daily
-> 2 client
-> 3 day 1
-> 4 name John
->
->
-> What I expected (and wanted) from the use of //* is:
->
-> Pos Name Value
-> --- ---- -----
-> 1 daily
-> 2 client
-> 3 day 1
-> 4 name John
-> 5 daily
-> 6 client
-> 7 day 2
-> 8 name Margaret
->
->
-> Would someone please explain why this is happening and what I should
do
-> to get the results I need?
->
-> Thanks in advance
->
-> Mike McBee
-> Signature House
->
->
->
->
-> monthly process.xsl
-> -------------------
-> <?xml version="1.0"?>
-> <xsl:stylesheet version="1.0"
-> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-> <xsl:template match="/">
-> <table border="1">
-> <xsl:variable name="monthly_link" select="document('monthly
-> list.xml')/monthly/day"/>
-> <tr><td>Pos</td><td>Name</td><td>Value</td></tr>
-> <xsl:for-each select="SEE ABOVE">
-> <tr>
-> <td><xsl:number value="position()" format="1"/></td>
-> <td><xsl:value-of select="name(self::node())"/></td>
-> <td><xsl:value-of select="normalize-space(text())"/></td>
-> </tr>
-> </xsl:for-each>
-> </table>
-> </xsl:template>
-> </xsl:stylesheet>
->
->
-> list nodes.xml
-> --------------
-> <?xml version="1.0"?>
-> <?xml-stylesheet type="text/xsl" href="monthly process.xsl"?>
-> <null>null</null>
->
->
-> monthly list.xml
-> ----------------
-> <?xml version="1.0"?>
-> <monthly>
-> <day link="day1.xml"/>
-> <day link="day2.xml"/>
-> </monthly>
->
->
-> day1.xml
-> --------
-> <?xml version="1.0"?>
-> <daily>
-> <client>
-> <day>1</day>
-> <name>John</name>
-> </client>
-> </daily>
->
->
-> day2.xml
-> --------
-> <?xml version="1.0"?>
-> <daily>
-> <client>
-> <day>2</day>
-> <name>Margaret</name>
-> </client>
-> </daily>
->
->
->
->
->
-> --~------------------------------------------------------------------
-> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
-> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
-> or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
-> --~--
->
->
-> --~------------------------------------------------------------------
-> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
-> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
-> or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
-> --~--
->
->
->



--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Scott Trenda
2008-01-11 16:23:12 UTC
Permalink
I'm not using Javascript, and it looks like the original poster is
either:

-> list nodes.xml
-> --------------
-> <?xml version="1.0"?>
-> <?xml-stylesheet type="text/xsl" href="monthly process.xsl"?>
-> <null>null</null>

As far as I know, if your parameters are correct and the
transformation's initializing correctly, there's not much opportunity
for Javascript to mishandle the transform or its results. And if the
misbehavior in question is one related to the XPath within the
stylesheet, then Javascript definitely isn't responsible. Just for
future reference.

~ Scott


-----Original Message-----
From: W Charlton [mailto:***@ymonda.net]
Sent: Friday, January 11, 2008 3:38 AM
To: xsl-***@lists.mulberrytech.com
Subject: RE: [xsl] Document Function Befuddlement

Assuming you are using JavaScript to process the transform, could you
show
your JavaScript or a link to the page you are testing on?

It is possible that there is a problem there.


William Charlton
The yMonda team
yMonda Limited
w: www.ymonda.net


-----Original Message-----
From: Scott Trenda [mailto:***@oati.net]
Sent: 2008 January 10 18:53
To: xsl-***@lists.mulberrytech.com
Subject: RE: [xsl] Document Function Befuddlement

Well, the second one makes sense; descendant-or-self::* also selects
root nodes, and each new document has a root node. Also, your stylesheet
would probably be more easily debugged by using these in the <for-each>:

<td><xsl:number/></td>
<td><xsl:value-of select="name()"/></td>
<td><xsl:value-of select="normalize-space()"/></td>

That'll give you the position in the source document (instead of the
position in the context node-set), the name of the context node,
whatever it may be (avoid any self:: restriction confusion here), and
the native string-value of the node. Perhaps then it'll be clear as to
what exactly the processor is computing.


IE uses MSXML, which is generally solid and standard-compliant. libxslt
(xsltproc) is a good, free processor that is generally as dependable as
MSXML. I believe the latest version of Apple's Safari for Windows uses
libxslt; it's the only built-in libxslt implementation I know of in
Windows. (aside from XML IDEs, of course.)

~ Scott


-----Original Message-----
From: Signature House [mailto:***@signaturehouse.net]
Sent: Thursday, January 10, 2008 12:40 PM
To: xsl-***@lists.mulberrytech.com
Subject: RE: [xsl] Document Function Befuddlement

Scott

Thanks, that works, but it just makes the whole thing weirder.

I also tried:

<xsl:for-each
select="document($monthly_link/@link)/descendant-or-self::*">

but got the same results as before, only the first file came thru and it
added some blank lines:

Pos Name Value
--- ----
1
2 daily
3 client
4 day 1
5
6 name John
7

I'd really like to get rid of having to specify the /daily so I could
use it as a generic utility - just change the name of the file
with the list of file names and run this against it. Also, this wouldn't
work if the input files didn't all have the same structure.

I'll take Michael Kay's advice and try another processor.

Anyone have any suggestions for a 1.0 processor that'll run under
Windows XP (cheap or free)?

Thanks

Mike McBee
Signature House
***@signaturehouse.net
www.signaturehouse.net
304-842-3386

-> -----Original Message-----
-> From: Scott Trenda [mailto:***@oati.net]
-> Sent: Thursday, January 10, 2008 12:03 PM
-> To: xsl-***@lists.mulberrytech.com
-> Subject: RE: [xsl] Document Function Befuddlement
->
->
-> I'm... not too sure about the genuine fix for the problem, but this
-> might be an acceptable workaround:
->
-> <xsl:for-each
-> select="document($monthly_link/@link)/daily/descendant-or-self::*">
->
-> ~ Scott
->
->
-> -----Original Message-----
-> From: Signature House [mailto:***@signaturehouse.net]
-> Sent: Thursday, January 10, 2008 10:57 AM
-> To: xsl-***@lists.mulberrytech.com
-> Subject: [xsl] Document Function Befuddlement
->
-> Document Function Befuddlement
->
-> I'm working on an application where I have to periodically run a
number
-> of xml files that I'm given through the same xsl transform.
-> Conveniently, I also get another xml file that lists the names of all
of
-> the data files, so this seemed like the perfect chance to
-> put the document function to good use (my first time).
->
-> I'm on a PC running XP SP2, using IE 7 & xsl 1.0. Below I've included
a
-> much reduced test process that I've been using to get it
-> working - it simply lists the position, name and value of all element
-> nodes.
->
-> 'day1.xml' & 'day2.xml' are the data files, 'monthly list.xml' is the
-> list of file names and I use 'list nodes.xml' to trigger the
-> whole thing by loading it into IE.
->
-> My befuddlement comes in because I'm getting more output from a more
-> restrictive selection criteria than I am from a less
-> restrictive selection criteria.
->
->
-> If, in 'monthly process.xsl', I use
->
-> <xsl:for-each select="document($monthly_link/@link)/daily//*">
->
-> I get, correctly:
->
-> Pos Name Value
-> --- ---- -----
-> 1 client
-> 2 day 1
-> 3 name John
-> 4 client
-> 5 day 2
-> 6 name Margaret
->
->
-> However, this doesn't show the daily nodes, which I wanted included
-> also, so I tried:
->
-> <xsl:for-each select="document($monthly_link/@link)//*">
->
-> I get, unexpectedly:
->
-> Pos Name Value
-> --- ---- -----
-> 1 daily
-> 2 client
-> 3 day 1
-> 4 name John
->
->
-> What I expected (and wanted) from the use of //* is:
->
-> Pos Name Value
-> --- ---- -----
-> 1 daily
-> 2 client
-> 3 day 1
-> 4 name John
-> 5 daily
-> 6 client
-> 7 day 2
-> 8 name Margaret
->
->
-> Would someone please explain why this is happening and what I should
do
-> to get the results I need?
->
-> Thanks in advance
->
-> Mike McBee
-> Signature House
->
->
->
->
-> monthly process.xsl
-> -------------------
-> <?xml version="1.0"?>
-> <xsl:stylesheet version="1.0"
-> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-> <xsl:template match="/">
-> <table border="1">
-> <xsl:variable name="monthly_link" select="document('monthly
-> list.xml')/monthly/day"/>
-> <tr><td>Pos</td><td>Name</td><td>Value</td></tr>
-> <xsl:for-each select="SEE ABOVE">
-> <tr>
-> <td><xsl:number value="position()" format="1"/></td>
-> <td><xsl:value-of select="name(self::node())"/></td>
-> <td><xsl:value-of select="normalize-space(text())"/></td>
-> </tr>
-> </xsl:for-each>
-> </table>
-> </xsl:template>
-> </xsl:stylesheet>
->
->
-> list nodes.xml
-> --------------
-> <?xml version="1.0"?>
-> <?xml-stylesheet type="text/xsl" href="monthly process.xsl"?>
-> <null>null</null>
->
->
-> monthly list.xml
-> ----------------
-> <?xml version="1.0"?>
-> <monthly>
-> <day link="day1.xml"/>
-> <day link="day2.xml"/>
-> </monthly>
->
->
-> day1.xml
-> --------
-> <?xml version="1.0"?>
-> <daily>
-> <client>
-> <day>1</day>
-> <name>John</name>
-> </client>
-> </daily>
->
->
-> day2.xml
-> --------
-> <?xml version="1.0"?>
-> <daily>
-> <client>
-> <day>2</day>
-> <name>Margaret</name>
-> </client>
-> </daily>
->
->
->
->
->
-> --~------------------------------------------------------------------
-> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
-> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
-> or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
-> --~--
->
->
-> --~------------------------------------------------------------------
-> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
-> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
-> or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
-> --~--
->
->
->



--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Signature House
2008-01-11 17:59:49 UTC
Permalink
William Charlton wrote:
-> Assuming you are using JavaScript to process the transform, could you show
-> your JavaScript or a link to the page you are testing on?
->
-> It is possible that there is a problem there.
->

William,

I included everything I'm using in the original post - no Javascipt, I simply open the 'list nodes.xml' in IE and everything runs
from that. And I'm doing it all local, so no link.

*****************************************************************

Scott Trenda wrote:
-> Well, the second one makes sense; descendant-or-self::* also selects
-> root nodes, and each new document has a root node. Also, your stylesheet
-> would probably be more easily debugged by using these in the <for-each>:
->
-> <td><xsl:number/></td>
-> <td><xsl:value-of select="name()"/></td>
-> <td><xsl:value-of select="normalize-space()"/></td>
->
-> That'll give you the position in the source document (instead of the
-> position in the context node-set), the name of the context node,
-> whatever it may be (avoid any self:: restriction confusion here), and
-> the native string-value of the node. Perhaps then it'll be clear as to
-> what exactly the processor is computing.
->
->

Scott,

I added the 3 statements you provided (in parallel with what was already there) and added in a bit more of the original template
that I took the sample from to get more info (level & path to the node) and re-ran it with both variations
['/daily/descendant-or-self::node()' and 'descendant-or-self::node()'].

I've included the new code below and the results. Strangely, the number element produced all 1's. And the
'descendant-or-self::node()' version contains an contains an additional first line that isn't present in the
'/daily/descendant-or-self::node()' variation.


I'm still working on Michael Kay's suggestion to try another processor.

Mike McBee
Signature House
***@signaturehouse.net
www.signaturehouse.net
304-842-3386


monthly process.xml
-------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<table border="1">
<xsl:variable name="monthly_link" select="document('monthly list.xml')/monthly/day"/>
<tr><td>Pos</td><td>Level</td><td>Path</td><td>Name</td><td>Value</td></tr>

<xsl:for-each select="document($monthly_link/@link)SEE BELOW">

<tr>
<td>{<xsl:number value="position()"/>}-{<xsl:number/>}</td>
<td><xsl:value-of select="count(ancestor-or-self::*)"/></td>
<td>
<xsl:for-each select="ancestor::node()">
<xsl:value-of select="name()"/>
<xsl:text>/</xsl:text>
</xsl:for-each>
</td>
<td>{<xsl:value-of select="name(self::node())"/>}-{<xsl:value-of select="name()"/>}</td>
<td>{<xsl:value-of select="normalize-space(text())"/>}-{<xsl:value-of select="normalize-space()"/>}</td>
</tr>

</xsl:for-each>

</table>
</xsl:template>
</xsl:stylesheet>


/daily/descendant-or-self::node() variation:

Pos Level Path Name Value
--- ----- ------------------- ----------------- -----
{1}-{1} 1 / {daily}-{daily} {}-{1 John}
{2}-{1} 2 /daily/ {client}-{client} {}-{1 John}
{3}-{1} 3 /daily/client/ {day}-{day} {1}-{1}
{4}-{1} 3 /daily/client/day/ {}-{} {}-{1}
{5}-{1} 3 /daily/client/ {name}-{name} {John}-{John}
{6}-{1} 3 /daily/client/name/ {}-{} {}-{John}
{7}-{1} 1 /X{daily}-{daily} {}-{2 Margaret}
{8}-{1} 2 /daily/ {client}-{client} {}-{2 Margaret}
{9}-{1} 3 /daily/client/ {day}-{day} {2}-{2}
{10}-{1} 3 /daily/client/day/ {}-{} {}-{2}
{11}-{1} 3 /daily/client/ {name}-{name} {Margaret}-{Margaret}
{12}-{1} 3 /daily/client/name/ {}-{} {}-{Margaret}


descendant-or-self::node() variation:

Pos Level Path Name Value
--- ----- ------------------- ----------------- -----
{1}-{1} 0 {}-{} {}-{1 John}
{2}-{1} 1 / {daily}-{daily} {}-{1 John}
{3}-{1} 2 /daily/ {client}-{client} {}-{1 John}
{4}-{1} 3 /daily/client/ {day}-{day} {1}-{1}
{5}-{1} 3 /daily/client/day/ {}-{} {}-{1}
{6}-{1} 3 /daily/client/ {name}-{name} {John}-{John}
{7}-{1} 3 /daily/client/name/ {}-{} {}-{John}





--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Signature House
2008-01-22 18:45:43 UTC
Permalink
Document Function Befuddlement - results

As you may remember, I was getting unexpected results when I tried running a transform against multiple XML input files (unexpected
in that I wasn't getting the same results that I got when I ran the transform against the XML files individually).

I was using statements in this form in IE7:

<xsl:template match="/">
<xsl:variable name="file_list" select="document('file name list.xml.xml')/monthly/day"/>
<xsl:for-each select="document($file_list/@link)//*">

and other variations, resulting in either absent or extra lines appearing in the result.

Michael Kay remarked that it looked like a bug in the IE7 processor and suggested that I try another processor. I did, and the above
coding worked fine - IE was the problem.

After experimenting (a lot), I found that this worked correctly in IE7:

<xsl:variable name="file_list" select="document('file name list.xml')//@link"/>
<xsl:for-each select="document($file_list)">
<xsl:for-each select="//*|//@*">


My thanks for your help, this list is a great resource.

Mike McBee
Signature House
***@signaturehouse.net
www.signaturehouse.net
304-842-3386


Element and Attribute List, by File
Position Level Path Name Value Type
-------- ----- -------------- ------ -------- ---------
1 1 / daily element
2 2 /daily/ client element
3 2 /daily/client/ s m attribute
4 3 /daily/client/ day 1 element
5 3 /daily/client/ name John element
1 1 / daily element
2 2 /daily/ client element
3 2 /daily/client/ s f attribute
4 3 /daily/client/ day 2 element
5 3 /daily/client/ name Margaret element



listnodes.xsl
-------------
<?xml version="1.0"?>
<xsl:template match="/">
<xsl:variable name="file_list" select="document('file name list.xml')//@link"/>
<table border="1">
<tr><td colspan="6">Element and Attribute List, by File</td></tr>
<tr><td>Position</td><td>Level</td><td>Path</td>
<td>Name</td><td>Value</td><td>Type</td></tr>
<xsl:for-each select="document($file_list)">
<xsl:for-each select="//*|//@*">
<xsl:if test="''=''">
<tr>
<!-- Get the sequential position in the node set -->
<td><xsl:number value="position()"/></td>
<!-- Get the level in the tree -->
<td><xsl:value-of select="count(ancestor-or-self::*)"/></td>
<!-- Get the path -->
<td>
<xsl:for-each select="ancestor::node()">
<xsl:value-of select="name()"/>
<xsl:text>/</xsl:text>
</xsl:for-each>
</td>
<!-- Get the node name -->
<td><xsl:value-of select="name(self::node())"/></td>
<xsl:choose>
<xsl:when test="self::*">
<!-- For an element node, get the value and indicate type -->
<td><xsl:value-of select="normalize-space(text())"/></td>
<td><xsl:value-of select="'element'"/></td>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="count(.|../@*)=count(../@*)">
<!-- For an attribute, get the value and indicate type -->
<td><xsl:value-of select="normalize-space(.)"/></td>
<td><xsl:value-of select="'attribute'"/></td>
</xsl:when>
<xsl:otherwise>
<!-- For anything else -->
<td><xsl:value-of select="normalize-space(.)"/></td>
<td><xsl:value-of select="'other'"/></td>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</tr>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>

launch list nodes.xml
---------------------
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href=".//list nodes.xsl"?>
<null>null</null>

file name list.xml
------------------
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl"?>
<monthly>
<day link="day1.xml"/>
<day link="day2.xml"/>
</monthly>

day1.xml
--------
<?xml version="1.0"?>
<daily>
<client s="m">
<day>1</day>
<name>John</name>
</client>
</daily>

day2.xml
--------
<?xml version="1.0"?>
<daily>
<client s="f">
<day>2</day>
<name>Margaret</name>
</client>
</daily>



--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--

Michael Kay
2008-01-10 17:36:32 UTC
Permalink
Looks suspiciously like a bug in the processor to me. Try running a
different XSLT processor to see if you get the same results.

Michael Kay
http://www.saxonica.com/
Post by Scott Trenda
-----Original Message-----
Sent: 10 January 2008 16:57
Subject: [xsl] Document Function Befuddlement
Document Function Befuddlement
I'm working on an application where I have to periodically
run a number of xml files that I'm given through the same xsl
transform.
Conveniently, I also get another xml file that lists the
names of all of the data files, so this seemed like the
perfect chance to put the document function to good use (my
first time).
I'm on a PC running XP SP2, using IE 7 & xsl 1.0. Below I've
included a much reduced test process that I've been using to
get it working - it simply lists the position, name and value
of all element nodes.
'day1.xml' & 'day2.xml' are the data files, 'monthly
list.xml' is the list of file names and I use 'list
nodes.xml' to trigger the whole thing by loading it into IE.
My befuddlement comes in because I'm getting more output from
a more restrictive selection criteria than I am from a less
restrictive selection criteria.
If, in 'monthly process.xsl', I use
Pos Name Value
--- ---- -----
1 client
2 day 1
3 name John
4 client
5 day 2
6 name Margaret
However, this doesn't show the daily nodes, which I wanted
Pos Name Value
--- ---- -----
1 daily
2 client
3 day 1
4 name John
Pos Name Value
--- ---- -----
1 daily
2 client
3 day 1
4 name John
5 daily
6 client
7 day 2
8 name Margaret
Would someone please explain why this is happening and what I
should do to get the results I need?
Thanks in advance
Mike McBee
Signature House
monthly process.xsl
-------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<table border="1">
<xsl:variable name="monthly_link" select="document('monthly
list.xml')/monthly/day"/>
<tr><td>Pos</td><td>Name</td><td>Value</td></tr>
<xsl:for-each select="SEE ABOVE">
<tr>
<td><xsl:number value="position()" format="1"/></td>
<td><xsl:value-of select="name(self::node())"/></td>
<td><xsl:value-of select="normalize-space(text())"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
list nodes.xml
--------------
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="monthly process.xsl"?>
<null>null</null>
monthly list.xml
----------------
<?xml version="1.0"?>
<monthly>
<day link="day1.xml"/>
<day link="day2.xml"/>
</monthly>
day1.xml
--------
<?xml version="1.0"?>
<daily>
<client>
<day>1</day>
<name>John</name>
</client>
</daily>
day2.xml
--------
<?xml version="1.0"?>
<daily>
<client>
<day>2</day>
<name>Margaret</name>
</client>
</daily>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Vincent Hennebert
2008-01-11 11:14:15 UTC
Permalink
Post by Vincent Hennebert
Well you can also use an absolutely positioned block-container with
Considering section 4.9.6 of the specification, I'm not confident this
is guaranteed to work as desired by the original poster.
Perhaps adding z-index="-1" to the above will change the stacking
layer sufficiently that the following blocks are not in conflict ...
but your example of putting this a the start of the flow means that
the background image is only going to be on the first page and not on
every page.
... Indeed! Didn’t think of that :-\
If you then make the decision to move the specification of the
absolutely-positioned block container to one of the perimeter areas
and static content, so that it appears on every page, there may still
be a problem: someone on the committee told me that there is no
guarantee that the unspecified z-index of a perimeter region is less
than the unspecified z-index of the body region.
And not even, apparently, that a lower z-index on e.g. the
region-before’s content will make it appear below the content of the
region-body. Since IIUC the stacking contexts aren’t the same.
Perhaps a combination of the block-container, in a perimeter region,
with a lower z-index than the content of the body region (which
7.30.18 implies is zero) would do the trick. I'd appreciate it if
someone on the committee would comment on this.
Indeed, actually this is not obvious whether the trick above will work
or not. In practice it should be tested with the FO processor that will
be used in production. “Your mileage may vary.”

Vincent


--
Vincent Hennebert Anyware Technologies
http://people.apache.org/~vhennebert http://www.anyware-tech.com
Apache FOP Committer FOP Development/Consulting


--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-***@lists.mulberrytech.com>
--~--
Continue reading on narkive:
Loading...