xsl-list
[Top] [All Lists]

RE: RE: [xsl] Problem with Xpath

2006-12-14 07:19:19
After the transformation from XML to XML-FO, and before the XML-FO is processed 
into a PDF document, you have an XML document in XML-FO format. Let's say that 
you are using the FOP processor from Apache to produce a PDF file. The your 
process looks like this, with the superscripted arrows representing the 
processing and the bits connected by the arrows representing the inputs and 
outputs of the process.

       XSLT              FOP
XML  ----> XML-FO -----> PDF


Your problem is that your XSLT process is not producing the correct XML-FO 
document. So, naturally, when FOP takes that document and creates a PDF file 
from it, you won't be getting the output you are looking for.

Please islolate the XML-FO document that is the intermediate product of the 
process, and send a representative example of what isn't what you expect. Come 
to think of it, since you don't seem to be familiar with the processing model, 
you may not be able to identify the relevant section. In that case, post a 
chunk of what you think may be relevant and we can work from there.

-- 
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     ms <mina_hurray(_at_)yahoo(_dot_)com>
Sent:     Thu, 14 Dec 2006 05:51:58 -0800 (PST)
To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:  RE: [xsl] Problem with Xpath

Hello:

I suppose I dont understand by XML output. My input is
an XML, and then I apply my XSLFO to the XML input
that I described and the output I described is
actually what I see on the PDF and is not in an XML
format. Please let me know if thats what u asked. 


--- cknell(_at_)onebox(_dot_)com wrote:

You are still describing your output instead of
showing it. Please don't ask me to decipher your
description in order to re-create what the output
should look like. Please send an example (NOT a
description) of the output. That means I want to see
XML, not:
==================================== > 1. First level
  A. some text
2. Second level

That is, the style sheet formats these levels 1 thru
6
with the following 1, A, (1), (a), 1) , a)

So if l3's conditions match, then it should be
counted
as level 2 and not as level3. Hence level 3 should
have 'A.' and not (1).

But the actual output is:
1. First level
    (1) some text
2. Second level

Also, if suppose the parameters are chnged to Target
and Pen, then the desired output is:

1. Second level
=============================== > 
So, try again. Send examples of the XML you now get
and the XML you want to get and I'll take a crack at
it.
-- 
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     ms <mina_hurray(_at_)yahoo(_dot_)com>
Sent:     Wed, 13 Dec 2006 14:10:28 -0800 (PST)
To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:  RE: RE: [xsl] Problem with Xpath

Thanks a lot for your help so far.
The XML looks like this:
<root>

<l1>
                      <text>
                              <para>First level</para>
                      </text>
                      <info>
                              <comp>Kmart</comp>
                              <prod>Shoes</prod>
                      </info>
                      <l2>
                      <text>
                              <para>Second level .</para>
                      </text>
<l3>
<text>
                              <para>some text</para>
                      </text>
                      <info>
                              <comp>Kmart</comp>
                              <prod>Shoes</prod>
                      </info>

</l3>
                      </l2>
              </l1>
              <l1>
                      <text>
                              <para>Second level</para>
                              <info>
                              <comp>Kmart</comp>
                              <prod>Shoes</prod>
                      </info>
                      </text>
              </l1>
                      <l1>
                      <text>
                              <para>Third level</para>
                              <info>
                              <comp>Target</comp>
                              <prod>Pen</prod>
                      </info>
                      </text>
              </l1>
</root>

I am passing the parameters company and product to
the
style sheet. If company=Kmart and product = SHoes
the
output should be:


1. First level
  A. some text
2. Second level

That is, the style sheet formats these levels 1 thru
6
with the following 1, A, (1), (a), 1) , a)

So if l3's conditions match, then it should be
counted
as level 2 and not as level3. Hence level 3 should
have 'A.' and not (1).

But the actual output is:
1. First level
    (1) some text
2. Second level

Also, if suppose the parameters are chnged to Target
and Pen, then the desired output is:

1. Second level

Instead, I now get,

2. Second level

The XSLT is:

<xsl:template match="l1">
<xsl:choose>
                      <xsl:when test=".//info">
                              <xsl:if test=".//info/company=$company and
.//info/product=$product">
                                      <fo:list-block>
                                              <fo:list-item>
                                                      <fo:list-item-label>
                                                              <fo:block>
                                                                      
<xsl:number format="1"/>
                                                              </fo:block>
                                                      </fo:list-item-label>
                                                      <fo:list-item-body>
                                                              <fo:block>
                                                                      
<xsl:apply-templates/>
                                                              </fo:block>
                                                      </fo:list-item-body>
                                              </fo:list-item>
                                      </fo:list-block>
                              </xsl:if>
                      </xsl:when>
                      <xsl:otherwise>
                      <!-- Do something else-->
                      </xsl:otherwise>
              </xsl:choose>
      </xsl:template>

This template repeats for all 6 levels. 


--- cknell(_at_)onebox(_dot_)com wrote:

<xsl:number> is probably a false friend in this
situation. I have a notion of what you need to do,
but it will be much easier to help if you post an
example (as opposed to the description you gave)
of
what the output you are now getting looks like,
and
a second example of the output you would like to
get.
-- 
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     ms <mina_hurray(_at_)yahoo(_dot_)com>
Sent:     Wed, 13 Dec 2006 11:45:34 -0800 (PST)
To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:  RE: [xsl] Problem with Xpath

Thank you the .//info worked. But I guess I have a
new
problem now, since there is some styling to format
these levels as 1, 2, 3 etc, now if the second<l1>
tag
matched then the numbering starts with 2. instead
of
1. 

Is there any way to start this numebring at 1
instead
of 2 so that even in between if there are levels
that
have to be missed the numbering stays as 1,2 , 3
and
not 2, 5, ,6 etc.

Please let me know.

=== message truncated == 


 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.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-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)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-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--