[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: formatting issues

Subject: Re: formatting issues
From: ms <mina_hurray@xxxxxxxxx>
Date: Thu, 2 Nov 2006 08:43:32 -0800 (PST)
Re:  formatting issues
Thank you very much for your interest and response.
Here is my response:

 >Your test tries to establish if there is any "sym"
> element with a value of 
> >"R" that is a child of a "state" element that my be
> at any level in the 
> >document. If so then it goes on to create a table.
> >
> >Is that really what you want to do?

- Yes, the 'sym' element can have values R, A and C.
So depending on the value of sym, the heading for the
table changes. I have done a similar code for the
other values also. 



> 
> 
> 
> >From: cknell@xxxxxxxxxx
> >Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >Subject: RE: RE: Re:  formatting issues
> >Date: Thu, 02 Nov 2006 10:18:25 -0500
> >
> >I'm willing to work with you on this, but the XSLT
> you showed is such an 
> >awful mess that in order for me to spend time on
> the problem, we'll have to 
> >clean it up no matter that "So hetting these to
> display correctly on the 
> >XSLT is not an issue."
> >
> >Based on what I see in your stylesheet, I surmise
> that you are fairly new 
> >to XSLT, or at least, you haven't had the benefit
> of training by someone 
> >with a good understanding of the processing model.
> >
> >So let's start with your first template. I'll quote
> from the first part:
> >
> ><xsl:template match="states">
> >   <br/>
> >   <xsl:if test="//state/sym='R'">
> >
> >Your test tries to establish if there is any "sym"
> element with a value of 
> >"R" that is a child of a "state" element that my be
> at any level in the 
> >document. If so then it goes on to create a table.
> >
> >Is that really what you want to do? Since you say
> that all "state" elements 
> >are children of one "states" element, there is no
> point in starting the 
> >test attribute value with two slashes. You could
> accomplish the same thing, 
> >with less confusion and at less processing cost by
> replacing your construct 
> >with this one, IF that's what you need to do.
> >
> ><xsl:template match="states">
> >   <br/>
> >   <xsl:if test="state/sym='R'">
> >
> >The next question concerns this:
> >
> ><xsl:for-each select="//state">
> >   <xsl:choose>
> >     <xsl:when test="sym='R'">
> >
> >Here again you are instructing the processor to
> find all "state" elements 
> >at whatever level they may be found in the source
> document. As I said 
> >earlier, it is rare that "xsl:for-each" is required
> outside of a situation 
> >where you need to sort elements in the output. And
> you don't seem to be 
> >sorting anything here. It is widely recognized that
> people new to XSLT who 
> >come from an imperative or procedural programming
> background are usually 
> >puzzled by the processing model and sieze on "for
> each" as a familiar 
> >landmark. While it usually does what you want it to
> do, it is a false 
> >friend in that it retards the process of absorbing
> the XSLT processing 
> >model.
> >
> >So if what you want is for the stylesheet to
> process those "state" elements 
> >in your source document that have a "sym" child
> with a value of "R", your 
> >stylesheet should start like this:
> >
> ><xsl:template match="states">
> >   <xsl:apply-templates select="state[sym='R']" />
> ></xsl:template>
> >
> ><xsl:template match="state">
> >   <tr>
> >     <td><xsl:value-of select="Val1"/></td>
> >     <td><xsl:value-of select="Val2"/></td>
> >     <td><xsl:value-of select="Val3"/></td>
> >     <td><xsl:value-of select="Val4"/></td>
> >     .... Code to deal with external document goes
> here ....
> ></tr>
> ></xsl:template>
> >
> >Do you want to do anything with "state" elements
> that have no "sym" child 
> >or have a "sym" child with a value other than "R",
> or do you wish to omit 
> >them from the output?
> >
> >I'll continue when we both have an understanding of
> what's really wanted.
> >Please advise.
> >--
> >Charles Knell
> >cknell@xxxxxxxxxx - email
> >
> >
> >
> >-----Original Message-----
> >From:     ms <mina_hurray@xxxxxxxxx>
> >Sent:     Thu, 2 Nov 2006 06:33:02 -0800 (PST)
> >To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >Subject:  RE: Re:  formatting issues
> >
> >Hello:
> >
> >Thank you all for taking time to go through my
> >question.
> >
> >Let me try to explain this.
> >
> >I have an input file:
> >
> ><states>
> >  <state>
> ><sym>R<sym>
> ><Val1>text<Val1>
> ><Val2>text<Val2>
> ><Val3>text<Val3>
> ><Val4>text<Val4>
> ><state>
> ></states>
> >
> >Now there can be any number of "state" child
> elements
> >under "states". The children of "state" are Val1,
> >Val2, Val3, Val4. So hetting these to display
> >correctly on the XSLT is not an issue.
> >
> >Next, we come to the <xsl:apply-templates
> >select="server/getinfo.dox.../>
> >
> >This server call returns data in XML format which
> is:
> >
> ><results>
> >
> ><data>
> ><Val5>something</Val5>
> ><Val6>something</Val6>
> ><Val7>something</Val7>
> ><Val8>P</Val8>
> ></data>
> >
> ><data>
> ><Val5>something</Val5>
> ><Val6>something</Val6>
> ><Val7>something</Val7>
> ><Val8>P</Val8>
> ></data>
> >
> ></results>
> >
> ><data> can be any number inside <results>
> >
> >The output should be like this. Consider the first
> >line the headers of the table:
> >
> >VAL1 VAL2 VAL3 VAL4 VAL5 VAL6 VAL7 VAL8
> >
> >Text
> >
> >--- cknell@xxxxxxxxxx wrote:
> >
> > > I'll try to help, but first I need the answers
> to
> > > some questions.
> > >
> > > The first template matches the element "states"
> > > ========================== > <xsl:template
> match="states">
> > >   <br/>
> > >   <xsl:if test="//state/sym='R'">
> > >  ... content omitted for clarity ...
> > > </xsl:template>
> > > ========================== >
> > > In your source XML document, is "states" the
> parent
> > > of all "state" elements, or do some "state"
> elements
> > > have "state" child elements?
> > >
> > >
> > > Further along in this template you have this:
> > > ========================== > <xsl:for-each
> select="//state">
> > > ========================== >
> 
=== message truncated ===



 
____________________________________________________________________________________
Get your email and see which of your friends are online - Right on the New Yahoo.com 
(http://www.yahoo.com/preview) 

Current Thread
  • RE: Re: formatting issues, (continued)
    • cknell - 1 Nov 2006 21:54:53 -0000
      • ms - 2 Nov 2006 14:33:19 -0000
      • ms - 2 Nov 2006 14:39:21 -0000
    • cknell - 2 Nov 2006 15:18:49 -0000
    • ms - 2 Nov 2006 16:43:54 -0000 <=
    • cknell - 2 Nov 2006 17:30:47 -0000
      • ms - 3 Nov 2006 16:24:53 -0000
    • cknell - 3 Nov 2006 20:29:02 -0000

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.