I’m searching for a fast way to write out the xml structure to a accompanying csv.
Source XML (metadata):
<?xml version="1.0" encoding="utf-8"?> <ol:Jo Version="2.1" xmlns:ol="olmeta2" xmlns:xs="http://www.w3.org/2001/XMLSchema/"> <ol:At/> <ol:Fi> <_vger_task_id>1</_vger_task_id> </ol:Fi> <ol:Gr Selected="true"> <ol:At/> <ol:Fi> <_vger_recordset_id>3384305</_vger_recordset_id> </ol:Fi> <ol:Do Selected="true"> <ol:At/> <ol:Fi> <_vger_record_id>1549540</_vger_record_id> <_vger_fld_KdNr>12091038</_vger_fld_KdNr> <_vger_fld_RechNr>200007063983</_vger_fld_RechNr> <_vger_fld_ExtraData/> </ol:Fi> <ol:Da Offset="" RealIndex=""> <ol:At/> <ol:Fi/> <ol:Pa> <ol:At/> <ol:Fi/> </ol:Pa> </ol:Da> </ol:Do> <ol:Do Selected="true"> <ol:At/> <ol:Fi> <_vger_record_id>1549541</_vger_record_id> <_vger_fld_KdNr>12091158</_vger_fld_KdNr> <_vger_fld_RechNr>200007063996</_vger_fld_RechNr> <_vger_fld_ExtraData/> </ol:Fi> <ol:Da Offset="" RealIndex=""> <ol:At/> <ol:Fi/> <ol:Pa> <ol:At/> <ol:Fi/> </ol:Pa> </ol:Da> </ol:Do> <ol:Do Selected="true"> <ol:At/> <ol:Fi> <_vger_record_id>1549542</_vger_record_id> <_vger_fld_KdNr>12091367</_vger_fld_KdNr> <_vger_fld_RechNr>200007064005</_vger_fld_RechNr> <_vger_fld_ExtraData/> </ol:Fi> <ol:Da Offset="" RealIndex=""> <ol:At/> <ol:Fi/> <ol:Pa> <ol:At/> <ol:Fi/> </ol:Pa> </ol:Da> </ol:Do> </ol:Gr> </ol:Jo>
XSLT:
<xsl:stylesheet version=“1.0” xmlns:xsl=“XSLT Namespace”
xmlns:ol=“XSLT Namespace”>
<xsl:output method=“text” />
<xsl:variable name=“separator” select=“‘;’” />
<xsl:variable name=“newline” select=“’ '” /><xsl:template match="/Jo/Gr/Do"> <xsl:text>ID;KndNr;RechNr</xsl:text> <xsl:value-of select="$newline" /> <xsl:for-each select="/Fi"> <xsl:value-of select="_vger_record_id" /> <xsl:value-of select="$separator" /> <xsl:value-of select="_vger_fld_KdNr" /> <xsl:value-of select="$separator" /> <xsl:value-of select="_vger_fld_RechNr" /> <xsl:value-of select="$newline" /> </xsl:for-each> </xsl:template>
</xsl:stylesheet>
What am I doing wrong?
Ralf.