XSLTを使用して、次のXMLを区切り記号「|」でフラットファイルに変換する必要があります。XSLTを使用したXMLからフラットファイルへの変換
これは私のXMLです:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><GeneralLedgerReport targetNamespace="http://www.portal.com/schemas/GLSync" xmlns="http://www.portal.com/schemas/GLSync" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.portal.com/schemas/GLSync brm_gl_data.xsd">
<SourceSystemID>Germany</SourceSystemID>
<ReportID>0.0.0.1-697031-1136</ReportID>
<RevenueType>Unbilled earned</RevenueType>
<BRM_GL_Segment>.</BRM_GL_Segment>
<ReportCreatedTime>
<Year>2013</Year>
<Month>01</Month>
<Day>14</Day>
<Hours>16</Hours>
<Minutes>2</Minutes>
<Seconds>3</Seconds>
</ReportCreatedTime>
<PeriodStartTime>
<Year>2012</Year>
<Month>10</Month>
<Day>15</Day>
<Hours>0</Hours>
<Minutes>0</Minutes>
<Seconds>0</Seconds>
</PeriodStartTime>
<PeriodEndTime>
<Year>2012</Year>
<Month>10</Month>
<Day>16</Day>
<Hours>0</Hours>
<Minutes>0</Minutes>
<Seconds>0</Seconds>
</PeriodEndTime>
</GeneralLedgerReport>
必要な出力: 総勘定元帳レポート
ドイツ| 0.0.0.1-697031-1136 |獲得した未請求| 2013/01/14-16:02: 03 | 2012/10/15-00:00:00 ドイツ| 0.0.0.1-697031-1136 |未請求獲得| 2013/01/14-16:02:03 | 2012/10/15-00:00:00 ドイツ| 0.0.0.1-697031-1136 |未請求獲得| 2013/01/14-16:02:03 | 2012/10/15-00:00:00 ドイツ| 0.0.0.1-697031-1136 |未請求獲得| 2013/01/14-16:02:03 | 2012/10/15-00:00:00
私は物事のカップルを試みたが、出力はとして提供されます:
が緊急にこれを必要とearned20130114160203201210150
をGermany0.0.0.1-697031-1136Unbilled、助けてください! ありがとう!
は、私は新しいXSLTに、区切り文字で別々の要素を取得する方法がわからない、私はこれを試してみました午前:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common"
xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="exslt java">
<xsl:output method="text" version="1.0" encoding="ISO-8859-1" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="/"/>
</xsl:template>
<xsl:template match="/">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
詳細XML:
<SourceSystemID>Germany</SourceSystemID>
<ReportID>0.0.0.1-697031-1116</ReportID>
<RevenueType>Unbilled earned</RevenueType>
<BRM_GL_Segment>.</BRM_GL_Segment>
<ReportCreatedTime>
<Year>2013</Year>
<Month>01</Month>
<Day>14</Day>
<Hours>16</Hours>
<Minutes>1</Minutes>
<Seconds>59</Seconds>
</ReportCreatedTime>
<PeriodStartTime>
<Year>2012</Year>
<Month>09</Month>
<Day>25</Day>
<Hours>0</Hours>
<Minutes>0</Minutes>
<Seconds>0</Seconds>
</PeriodStartTime>
<PeriodEndTime>
<Year>2012</Year>
<Month>09</Month>
<Day>26</Day>
<Hours>0</Hours>
<Minutes>0</Minutes>
<Seconds>0</Seconds>
</PeriodEndTime>
<SourceSystemID>Germany</SourceSystemID>
<ReportID>0.0.0.1-697031-1136</ReportID>
<RevenueType>Unbilled earned</RevenueType>
<BRM_GL_Segment>.</BRM_GL_Segment>
<ReportCreatedTime>
<Year>2013</Year>
<Month>01</Month>
<Day>14</Day>
<Hours>16</Hours>
<Minutes>2</Minutes>
<Seconds>3</Seconds>
</ReportCreatedTime>
<PeriodStartTime>
<Year>2012</Year>
<Month>10</Month>
<Day>15</Day>
<Hours>0</Hours>
<Minutes>0</Minutes>
<Seconds>0</Seconds>
</PeriodStartTime>
<PeriodEndTime>
<Year>2012</Year>
<Month>10</Month>
<Day>16</Day>
<Hours>0</Hours>
<Minutes>0</Minutes>
<Seconds>0</Seconds>
</PeriodEndTime>
名前空間(接頭辞とURI)を宣言する必要がある場合は、入力ツリーの要素を選択できません。さらに、あなたが望む出力は正しいですか?それは4回繰り返された単なる行ですか? –
@empo:基本的に入力は同じ方法で繰り返される巨大なXMLです。そのため、同じ数の行を繰り返す必要があります。接頭辞とURIを追加しようとします。これは正しいです? <?xmlのバージョンは、= "1.0" エンコード= "UTF-8"?> ます。 ます。 –
Gagan
入力XMLのもう少しを投稿してください(コメントは使用しないでくださいあなたの質問を編集) –