> -----Original Message-----
> From: Dana Tierney [mailto:[EMAIL PROTECTED]
> Sent: Sunday, April 29, 2007 11:26 PM
> To: CF-Community
> Subject: Re: need a suggestion
> 
> I wasn't thinking XML because I don't kow it all that well. But I think
> I see what you are saying -- let me look into that. What if it's not
> well-formed though?

Then it's a balancing act: is it easier to make it well formed or to parse
it out as it is?

Often the core data will be well formed - so just snipping off the "ends" of
the document will sometimes fix things.

XSLT is a tool for transforming XML into - it's pretty cumbersome and a
little tedious, but not difficult (definitely easier than learning/doing
manual parsing).  The w3cschools site has a brief, but useful overview of
the process here:

http://www.w3schools.com/xsl/xsl_transformation.asp

That demo shows the results in a browser, but in your case you'd probably
apply the XSL file separately in a script - but the results would be the
same.  That also shows converting an XML doc to HTML, but I hope you get the
idea - the XSLT works a lot like CF: it "lives" within the presentation
format and describes how data should be inserted.

I've done this with pre-defined XSL files to good effect but I'm not sure I
could write one up myself without some study first.

The tricky bit for you may be dealing with multiple TD's but XSL deals with
that with positional requestors.  XPATH is the "language" used in XSL for
selecting specific nodes.  Again, it's tedious but straightforward (if you
have a decent reference on hand).  For example to select the first TD under
a TR you might use this expression: "/tr/td[0]".

Taking a snippet from your sample:

<TR>
<TH CLASS="ddlabel" scope="row" >Cross List: </TH> <TD
CLASS="dddefault">0</TD> <TD CLASS="dddefault">0</TD> <TD
CLASS="dddefault">0</TD> </TR>

To get the data from that and convert it to a comma-seperated list you might
do something like this:

<xsl:for-each select="tr">
        <xsl:value-of select="td[0]"/>,<xsl:value-of select="
td[1]"/>,<xsl:value-of select=" td[2]"/>
</xsl:for-each>

Of course you need to test all of this (I think the above might actually
result in empty rows, you might have to comment or collapse some of the line
breaks).

It's confusing at first, but really pretty powerful.

Jim Davis


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create Web Applications With ColdFusion MX7 & Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Community/message.cfm/messageid:233511
Subscription: http://www.houseoffusion.com/groups/CF-Community/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5

Reply via email to