Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: transform XML to SQL by XSL [Thread Next] Re: transform XML to SQL by XSLTo: NULL Date: 9/8/2008 4:34:00 AM On Sep 8, 5:17=A0pm, "Joe Fawcett" <joefawc...@newsgroup.nospam> wrote: > Something like: > > <xsl:stylesheet version=3D"1.0" > xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"> > <xsl:output method=3D"text" encoding=3D"UTF-8"/> > <xsl:template match=3D"/"> > <xsl:apply-templates select=3D"Order"/> > </xsl:template> > <xsl:template match=3D"Order"> > <xsl:text>update order_details set quantity =3D </xsl:text> > <xsl:value-of select=3D"OrderItem/QuantityIncrease"/> > <xsl:text> where orderid =3D </xsl:text> > <xsl:value-of select=3D"@ID"/> > <xsl:text> and productid =3D </xsl:text> > <xsl:value-of select=3D"OrderItem/@ProductID"/> > </xsl:template> > </xsl:stylesheet> > > depending on how dynamic the actual names , like ProductID, are. > > -- > Joe Fawcett (MVP - XML)http://joe.fawcett.name > > <andie.du...@gmail.com> wrote in message > > news:1f3d63e5-12cf-4a6b-9920-70cb1d40061d@p...... > On Sep 5, 5:37 pm, "Joe Fawcett" <joefawc...@newsgroup.nospam> wrote: > > > > > <andie.du...@gmail.com> wrote in message > > >news:e2bfc74a-4dc8-4ea2-b40a-47f860265457@b.....= . > > > > i have thisxmlhere, and now i would like to usexsltotransform > > > into an Updatesqlstatement like this: > > > Here is theXMLdocument: > > > > <Order ID=3D"10248"> > > > <OrderItem ProductID=3D"11"> > > > <QuantityIncrease>2</QuantityIncrease> > > > </OrderItem> > > > </Order> > > > > Here is a bit i did: > > > > <?xmlversion=3D"1.0" encoding=3D"UTF-8"> > > > <xsl:stylesheet version=3D"1.0" xmlns:xsl=3D"http://www.w3.org/1999/X= SL/ > > >Transform"> > > > <xsl:input href =3D"WriteXMLToDBTest_Order.xml"/> > > > <xsl:output method=3D"text" encoding=3D"UTF-8"/> > > > > <xsl:template match=3D"/"> > > > <xsl:apply-templates select=3D"Order"/> > > > </xsl:template> > > > > <xsl:tempalte match=3D"Order"> > > > <xsl:text>update</xsl:text> > > > <xsl:value-of select=3D"Order Details"/> > > > </xsl:tempalte> > > > </xsl:stylesheet> > > > > as i am still new in this field, can someone guide me through? > > > > Many thanks > > > What is thexsl:input element? I haven't seen that one before, did you > > meanxsl:include orxsl:import? > > Can you show an example of whatSQLstatement should be produced by theXM= L > > you gave? > > > -- > > > Joe Fawcett (MVP -XML)http://joe.fawcett.name-Hide quoted text - > > > - Show quoted text - > > Hi Joe, > > Thanks very much for your reply. > > what i need in here is: > I want the xsl read the xml, so i think it is xsl:import, which is the > one that i provided at the very beginning, and i want to transform to > this sql statement: > update order_details set quantity =3D 12 where orderid =3D 10248 and > productid =3D 11 you are the champion Joe, thanks very much | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
