Subject: Re: [xsl] Help with xsl:result-document From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 25 Oct 2010 17:24:46 -0400 |
I've come to an impasse with trying to use xsl:result-document. I have a number of XML log files that I'm trying to extract data from and place that data into a database. I think it best to have 4 tables - OutCommand, InResponse, InCommand and OutResponse. To ease my SQL bulk import coding, I thought to produce 4 output files from one XSLT2.0 transform. However, I just can't figure out how to get result-document to work with my obvious limited knowledge of transforms. I'm looking to get 4 output files - OutCommandoutput.xml, InResponse-output.xml, InCommand-output.xml and OutResponse-output.xml. But I can't use templates, as I've more than one 'match' - and so the template tries (and obviously fails) to create another output stream to something it's already created. But I can't see a way out of this, so any advice, pointers or help will be, as ever, appreciated.
<xsl:template match="MyLog"> <xsl:element name="Device"> <xsl:apply-templates select="OutCommand"/> <xsl:apply-templates select="InResponse"/> <xsl:apply-templates select="InCommand"/> <xsl:apply-templates select="OutResponse"/> </xsl:element> </xsl:template>
<xsl:template match="OutCommand"> <xsl:result-document method="xml" href="OutCommandoutput.xml"> <OutCommand> ... </OutCommand> </xsl:result-document> </xsl:template>
<xsl:template match="InResponse"> <xsl:result-document method="xml" href="InResponse-output.xml"> <InResponse> ... </InResponse> </xsl:result-document> </xsl:template>
<xsl:template match="InCommand"> <xsl:result-document method="xml" href="InCommand-output.xml"> <InCommand> ... </InCommand> </xsl:result-document> </xsl:template>
<xsl:template match="OutResponse"> <xsl:result-document method="xml" href="OutResponse-output.xml"> <OutResponse> ... </OutResponse> </xsl:result-document> </xsl:template>
<xsl:template match="MyLog"> <xsl:result-document method="xml" href="OutCommandoutput.xml"> <xsl:apply-templates select="OutCommand"/> </xsl:result-document> <xsl:result-document method="xml" href="InResponse-output.xml"> <xsl:apply-templates select="InResponse"/> </xsl:result-document> <xsl:result-document method="xml" href="InCommand-output.xml"> <xsl:apply-templates select="InCommand"/> </xsl:result-document> <xsl:result-document method="xml" href="OutResponse-output.xml"> <xsl:apply-templates select="OutResponse"/> </xsl:result-document> </xsl:template>
<xsl:template match="OutCommand"> <OutCommand> ... </OutCommand> </xsl:template>
<xsl:template match="InResponse"> <InResponse> ... </InResponse> </xsl:template>
<xsl:template match="InCommand"> <InCommand> ... </InCommand> </xsl:template>
<xsl:template match="OutResponse"> <OutResponse> ... </OutResponse> </xsl:template>
-- XSLT/XQuery training: after http://XMLPrague.cz 2011-03-28/04-01 Vote for your XML training: http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Help with xsl:result-document, Neil Owens | Thread | RE: [xsl] Help with xsl:result-docu, Neil Owens |
[xsl] Help with xsl:result-document, Neil Owens | Date | RE: [xsl] Help with xsl:result-docu, Neil Owens |
Month |