I need to transform xml to plain xml with xsl from:
<LongAssetInfoMulti attrTagName.s="tagName" attrName.s="tagName" values.ll="14491 14553 14568 14581 15239 15240 15241"/>
to:
<tagName>14491</tagName>
<tagName>14553</tagName> ....
I allready did this:
<xsl:template match="/">
<xsl:variable name="test" select="//LongAssetInfoMulti/@values.ll"/>
<xsl:for-each select="$test">
<xsl:value-of select="$test"></xsl:value-of>
</xsl:for-each>
</xsl:template>
Anyone have any idea how to parse multiple attribute values?
As michael.hor257k said we can use tokenization, like below:
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ext="http://www.courts.state.mn.us/ProtectionOrderExtension/1.0" xmlns:nc="http://niem.gov/niem/niem-core/2.0" extension-element-prefixes="ext nc" exclude-result-prefixes="mscef msxsl exsl ext">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:variable name="test" select="//LongAssetInfoMulti/@values.ll"/>
<xsl:for-each select="tokenize($test, ' ')">
<xsl:sort select="$test"/>
<tagname>
<xsl:value-of select="."/>
</tagname>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.