Click here to Skip to main content
15,888,286 members
Home / Discussions / XML / XSL
   

XML / XSL

 
AnswerRe: XML+XLST simple simple question Pin
led mike1-Oct-08 4:57
led mike1-Oct-08 4:57 
GeneralRe: XML+XLST simple simple question Pin
Herds1-Oct-08 7:30
Herds1-Oct-08 7:30 
QuestionHow to catch an exception thrown by MSXML? [modified] Pin
JoeSchmoe00730-Sep-08 7:42
JoeSchmoe00730-Sep-08 7:42 
AnswerRe: How to catch an exception thrown by MSXML? Pin
led mike1-Oct-08 5:03
led mike1-Oct-08 5:03 
QuestionXDS Pin
postonoh29-Sep-08 11:36
postonoh29-Sep-08 11:36 
AnswerRe: XDS Pin
Dave Kreskowiak29-Sep-08 11:59
mveDave Kreskowiak29-Sep-08 11:59 
GeneralRe: XDS Pin
postonoh29-Sep-08 13:53
postonoh29-Sep-08 13:53 
Questionapply xsl on xml to generate sql Pin
AndieDu28-Sep-08 13:51
AndieDu28-Sep-08 13:51 
Hi All,

I have this XML files here:

<?xml version="1.0" encoding="utf-8">
<?xml-stylesheet type="text/xsl" href="TimesheetSQLScript.xsl"???>

<myfields>
<timesheetid>
<companycode>CCCRM</companycode>
<employee>Adrian</employee>
<weekpick>2008-09-15</weekpick>
<startdate>2008-09-15</startdate>
<note></note>
<enddate>2008-09-21</enddate>

<monday>
<mondate>2008-09-15</mondate>
<moncheck>
<moncheckin>14:10:00</moncheckin>
<moncheckout>15:44:00</moncheckout>
</moncheck>
<moncheck>
<moncheckin>16:44:00</moncheckin>
<moncheckout>22:50:00</moncheckout>
</moncheck>
</monday>
</timesheetid>
</myfields>

And I applied this XSL:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="utf-8" />
<xsl:template match="/">
Declare @TimeCardID int
<xsl:apply-templates select="myFields/TimesheetID/Monday" />
</xsl:template>

<xsl:template match="Monday">
<xsl:text>set @TimeCardID = exec spCreateTimeCard '</xsl:text>
<xsl:value-of select="MonDate" />
<xsl:text>', '</xsl:text>
<xsl:value-of select="/myFields/TimesheetID/Employee" />
<xsl:text>'</xsl:text>
<xsl:for-each select="MonCheck">
exec spCreateTimeCardSession @TimeCardID, '
<xsl:value-of select="MonCheckIn" />
<xsl:text>', '</xsl:text>
<xsl:value-of select="MonCheckOut" />
<xsl:text>'</xsl:text>
</xsl:for-each>
</xsl:template>

It generate this sql statement:

Declare @TimeCardID int
set @TimeCardID = exec spCreateTimeCard '2008-09-15', 'Adrian'
exec spCreateTimeCardSession @TimeCardID, '
14:10:00', '15:44:00'
exec spCreateTimeCardSession @TimeCardID,
'16:44:00', '22:50:00'

but this is not what i want, is there a way that i can generate this statement like this:
Declare @TimeCardID int
set @TimeCardID = exec spCreateTimeCard '2008-09-15', 'Adrian'
exec spCreateTimeCardSession @TimeCardID, '14:10:00', '15:44:00'
exec spCreateTimeCardSession @TimeCardID, '16:44:00', '22:50:00'

Thanks in advance </xsl:stylesheet>
AnswerRe: apply xsl on xml to generate sql Pin
AndieDu28-Sep-08 19:06
AndieDu28-Sep-08 19:06 
QuestionHow do I create a schema for elements with attributes Pin
Christian Wikander26-Sep-08 3:50
Christian Wikander26-Sep-08 3:50 
AnswerRe: How do I create a schema for elements with attributes Pin
led mike26-Sep-08 4:49
led mike26-Sep-08 4:49 
GeneralRe: How do I create a schema for elements with attributes Pin
Christian Wikander29-Sep-08 1:04
Christian Wikander29-Sep-08 1:04 
QuestionRss Feed problem, please help me. Pin
josseph.zhang22-Sep-08 3:49
josseph.zhang22-Sep-08 3:49 
AnswerRe: Rss Feed problem, please help me. Pin
led mike23-Sep-08 4:44
led mike23-Sep-08 4:44 
AnswerRe: Rss Feed problem, please help me. Pin
George L. Jackson23-Sep-08 18:01
George L. Jackson23-Sep-08 18:01 
GeneralRe: Rss Feed problem, please help me. Pin
josseph.zhang24-Sep-08 3:44
josseph.zhang24-Sep-08 3:44 
QuestionRoot Element Missing Pin
Srikant Talasila17-Sep-08 8:33
Srikant Talasila17-Sep-08 8:33 
QuestionRe: Root Element Missing Pin
led mike23-Sep-08 4:43
led mike23-Sep-08 4:43 
QuestionRe: Root Element Missing Pin
George L. Jackson23-Sep-08 17:47
George L. Jackson23-Sep-08 17:47 
QuestionHow I do? Pin
izzy8717-Sep-08 0:03
izzy8717-Sep-08 0:03 
GeneralRe: How I do? Pin
led mike23-Sep-08 4:42
led mike23-Sep-08 4:42 
QuestionXML Pin
MrMcIntyre15-Sep-08 9:29
MrMcIntyre15-Sep-08 9:29 
QuestionRe: XML Pin
led mike23-Sep-08 4:41
led mike23-Sep-08 4:41 
AnswerRe: XML Pin
MrMcIntyre23-Sep-08 5:45
MrMcIntyre23-Sep-08 5:45 
GeneralRe: XML Pin
led mike23-Sep-08 6:02
led mike23-Sep-08 6:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.