Tôi đang cố gắng chuyển đổi tệp XML thành tệp phẳng, được phân tách bằng đường ống với XSLT (để tải hàng loạt vào Postgres). Tôi muốn cột cuối cùng trong đầu ra của tôi là XML thực tế của nút (để xử lý sau và gỡ lỗi thêm). Ví dụ:cách bao gồm XML nút trong đầu ra văn bản XSLT của tôi?
<Library>
<Book id="123">
<Title>Python Does Everythig</Title>
<Author>Smith</Author>
</Book>
<Book id="456">
<Title>Postgres is Neat</Title>
<Author>Wesson</Author>
</Book>
</Library>
nên tạo
Python Does Everything|Smith|<Book id="123"><Title>Python Does Everythig</Title>Author>Smith</Author></Book>
Postgres is Neat|Wesson|<Book id="456"><Title>Postgres is Neat</Title><Author>Wesson</Author></Book>
XSL hiện tại của tôi là
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*" />
<xsl:output method="text" omit-xml-declaration="yes" indent="no" />
<xsl:template match="//Book">
<xsl:value-of select="Title" />
<xsl:text>|</xsl:text>
<xsl:value-of select="Author" />
<!-- put in the newline -->
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>