How would you handle the XML tag attributes using XSL?

ie: <money currency="USD">12.2</money>

I FINALLY got allaire's example to work (thanks David), but I don't even 
know where to start when it comes to the attributes. Any suggestions?

(If it helps, I'm trying to convert cXML to WDDX)

Thanks in advance,
Brian Kohnen

At 01:21 AM 5/24/00 -0700, you wrote:
>Thanks David, I will give it a go.  You the man.
>----- Original Message -----
>From: "David Gassner" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Tuesday, May 23, 2000 9:30 PM
>Subject: RE: XML Question
>
>
> > Sean, I got Allaire's example working.  I found these problems based on
>the
> > version I copied from the Allaire website:
> >
> > 1.  If you copy the example XSL file from the website, the
><xsl:stylesheet>
> > tag's xmlns:xsl attribute value is broken into 2 lines, causing the xsl
> > processor to fail completely.  Instead of doing the transformation, it was
> > just outputting the content of the original xsl file.  The namespace needs
> > to be in a continuous line, as follows:
> >
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> >
> > 2.  The printWriter class wasn't being closed, so the file containing the
> > wddx was never being flushed to disk.  I added the following to the end of
> > the code:
> >
> > <cfset printWriter.close()>
> >
> > 3.  The resulting processed file wasn't being read into a CF variable, so
>I
> > added:
> >
> > <cffile action="read"
> >    file="[path]wddx_test.wddx"
> >    variable="wddx">
> >
> > 4.  Next, when I tried to run <cfwddx> to transform the wddx to a
>structure,
> > I got:
> >
> > Error Diagnostic Information
> > unknown exception condition
> > TagCFWddx::execute
> >
> > There was an error in the XSL file: the "item" element was being mapped to
>a
> > named structure; since it was a structure within an array, it couldn't
>take
> > a name, causing the WDDX parser to fail.  I corrected the XSL file, and
> > everything now works.  Here's my corrected XSL file:
> >
> > ************************
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> >
> > <!-- Match invoice root & emit WDDX packet wrapper -->
> > <xsl:template match="/invoice">
> >     <wddxPacket version="1.0">
> >         <header/>
> >         <data>
> >             <struct>
> >                 <xsl:apply-templates/>
> >             </struct>
> >         </data>
> >     </wddxPacket>
> > </xsl:template>
> >
> >
> > <!-- Process all elements that map to array variables -->
> > <xsl:template match="billableHours">
> >     <var name="{name(.)}">
> >         <array length="{count(*)}">
> >             <xsl:apply-templates/>
> >         </array>
> >     </var>
> > </xsl:template>
> >
> > <!-- Process all elements that map to struct variables -->
> > <xsl:template match="invoice|contractorInfo|address">
> >     <var name="{name(.)}">
> >         <struct>
> >             <xsl:apply-templates/>
> >         </struct>
> >     </var>
> > </xsl:template>
> >
> >
> > <!-- Process structures inside arrays (no names) -->
> > <xsl:template match="item">
> >         <struct>
> >             <xsl:apply-templates/>
> >         </struct>
> > </xsl:template>
> >
> > <!-- Process all elements that map to string variables -->
> > <xsl:template
> > match="firstName|lastName|street|city|state|zip|country|voice|fax|email|
> > description|currency">
> >     <var name="{name(.)}">
> >         <string>
> >             <xsl:value-of select="text()"/>
> >         </string>
> >     </var>
> > </xsl:template>
> >
> > <!-- Process all elements that map to number variables -->
> > <xsl:template match="invoiceID|employeeID|hours|amount">
> >     <var name="{name(.)}">
> >         <number>
> >             <xsl:value-of select="text()"/>
> >         </number>
> >     </var>
> > </xsl:template>
> >
> > <!-- Process all elements that map to date-time variables -->
> > <xsl:template match="dateSubmitted|date">
> >     <var name="{name(.)}">
> >         <string>
> >             <xsl:value-of select="text()"/>
> >         </string>
> >     </var>
> > </xsl:template>
> >
> > </xsl:stylesheet>
> >
> > ************************
> >
> > I'll pass this info to the folks at Allaire.
> > --David
> >
> > > -----Original Message-----
> > > From: Sean Renet [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, May 23, 2000 5:53 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: XML Question
> > >
> > >
> > > yes, you would think someone would have tested the knowledge base
>article.
> > > I though it necessary to point this out as you directed someone that
>asked
> > > how to parse an XML file into CFML to your article which
> > > references this doc
> > > as the means to do such.
> > > ----- Original Message -----
> > > From: "David Gassner" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Tuesday, May 23, 2000 11:27 AM
> > > Subject: RE: XML Question
> > >
> > >
> > > > Interesting; I never actually tested Allaire's approach, but
> > > included the
> > > > reference in my article for the sake of completeness.  My
> > > article focuses
> > > on
> > > > parsing xml file's document object model, rather than
> > > translation with xls
> > > > (which the knowledgebase article deals with).
> > > >
> > > > Side note: I've been playing with IBM's java-based xerces processor
>from
> > > > <cfobject> and have been having some good results.
> > > >
> > > > David
> > > >
> > > > > -----Original Message-----
> > > > > From: Sean Renet [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Tuesday, May 23, 2000 11:09 AM
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: Re: XML Question
> > > > >
> > > > >
> > > > > David,
> > > > > The "Tech Note" you are refering to "
> > > > > www.allaire.com/handlers/index.cfm?ID=14244&Method=Full#1020244 "
> > > > >  does not
> > > > > work.  I have an open incident with Allaire, wherein they are
> > > trying to
> > > > > figure out why.  Evidently after they fix the problem they
> > > are going to
> > > > > update the knowledge base article.
> > > > > ----- Original Message -----
> > > > > From: "David Gassner" <[EMAIL PROTECTED]>
> > > > > To: <[EMAIL PROTECTED]>
> > > > > Sent: Tuesday, May 23, 2000 7:29 AM
> > > > > Subject: RE: XML Question
> > > > >
> > > > >
> > > > > > Bob, I wrote an article on using the MS XMLDOM COM object with
> > > > > CF to parse
> > > > > > conventional XML files; it's at:
> > > > > >
> > > > > > http://www.sys-con.com/xml/archives/0102/gassner/index.html
> > > > > >
> > > > > > Take a look and email me off-list if you need any clarification.
> > > > > >
> > > > > > David
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Robert Everland III [mailto:[EMAIL PROTECTED]]
> > > > > > > Sent: Monday, May 22, 2000 7:22 PM
> > > > > > > To: [EMAIL PROTECTED]
> > > > > > > Subject: XML Question
> > > > > > >
> > > > > > >
> > > > > > > Ok I get the gist on how to use WDDX, but how would I
> > > read in an XML
> > > > > > > document? Same prinipal, 3rd party utility?
> > > > > > >
> > > > > > >
> > > > > > > Bob Everland
> > > > > > >
> > > > > >
> > ------------------------------------------------------------------
> > > > > > > ------------
> > > > > > > Archives: http://www.eGroups.com/list/cf-talk
> > > > > > > To Unsubscribe visit
> > > > > > >
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf
> > > > > > _talk or send a message to [EMAIL PROTECTED] with
> > > > > > 'unsubscribe' in the body.
> > > > > >
> > > > > >
> > > >
> > > >
> >
> > --------------------------------------------------------------------------
> > > > > ----
> > > > > > Archives: http://www.eGroups.com/list/cf-talk
> > > > > > To Unsubscribe visit
> > > > >
> > http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
> > or
> > > > send a message to [EMAIL PROTECTED] with 'unsubscribe'
> > in
> > > > the body.
> > > > >
> > > >
> > > > ------------------------------------------------------------------
> > > > ------------
> > > > Archives: http://www.eGroups.com/list/cf-talk
> > > > To Unsubscribe visit
> > > http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
>or
> > > send a message to [EMAIL PROTECTED] with 'unsubscribe'
>in
> > > the body.
> > >
> >
> > --------------------------------------------------------------------------
> > ----
> > > Archives: http://www.eGroups.com/list/cf-talk
> > > To Unsubscribe visit
> > http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> > send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> > the body.
> > >
> >
> > --------------------------------------------------------------------------
>--
> > --
> > Archives: http://www.eGroups.com/list/cf-talk
> > To Unsubscribe visit
> > http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> > send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> > the body.
> >
> > --------------------------------------------------------------------------
>----
> > Archives: http://www.eGroups.com/list/cf-talk
> > To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
> >
>
>------------------------------------------------------------------------------
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit 
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or 
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in 
>the body.


------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to