Sample XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="no" omit-xml-declaration="yes" method="text" encoding="utf-8"/>
<xsl:strip-space elements="*"/>
<xsl:template match="main">
<xsl:value-of select="name"/>
SSN: <xsl:value-of select="ssn"/>
<xsl:text>
</xsl:text>
<xsl:value-of select="address1"/>
DOB: <xsl:value-of select="dob"/>
<xsl:text>
</xsl:text>
<xsl:value-of select="address2"/>
GENDER: <xsl:value-of select="gender"/>
EYE COLOR: <xsl:value-of select="eye"/>
HEIGHT: <xsl:value-of select="height"/>
HAIR COLOR: <xsl:value-of select="hair"/>
WEIGHT: <xsl:value-of select="weight"/>
</xsl:template>
</xsl:stylesheet>
Sample XML:
<main>
<name>CHTP CLS DEBY</name>
<dob>1999-01-08</dob>
<ssn>18454512</ssn>
<address1>115 Z 88TH UL #226-F</address1>
<address2>ARVADA, CO 80004</address2>
<gender>M</gender>
<eye>Blue</eye>
<hair>Brown</hair>
<height>182</height>
<weight>69</weight>
</main>
我想实现这样的目标,
CHTP CLS DEBY SSN: *****4512
115 Z 88TH UL #226-F DOB: 1999-01-08
ARVADA, CO 80004
Gender: M
Eye Color: Blue Height: 182
Hair Color: Brown Weight: 69
使用 XSL 转换。