xslt - XSL Remove element on value and add new element with concatenated value(1,2,3..) -
i new xslt , move forward. able use xsl false success values,but queid values shown in output.xml list, not go forward. appreciated.
xsl ========= <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:variable name="gb"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="//entity[success='true']"/> </xsl:stylesheet> input xml ============== <?xml version="1.0"?> <entities> <entity> <type/> <queid>14077317</queid> <enum>95299168</enum> <success>false</success> </entity> <entity> <type/> <queid>14077319</queid> <enum>95299151</enum> <success>false</success> </entity> <entity> <type/> <queid>14077320</queid> <enum>95299154</enum> <success>true</success> </entity> <entity> <type/> <queid>14077328</queid> <enum>95299164</enum> <success>false</success> </entity> <entity> <type/> <queid>14077329</queid> <enum>95299147</enum> <success>true</success> </entity> </entities> desired output xml =================== <?xml version="1.0"?> <entities> <entity> <type/> <queid>102</queid> <enum>98</enum> <success>true</success> </entity> <entity> <type/> <queid>104</queid> <enum>67</enum> <success>true</success> </entity> <entitylist>102,104</entitylist> </entities>
you need whether it's xslt 1.0 or 2.0. in 2.0, add template rule
<xsl:template match="entities"> <xsl:copy> <xsl:apply-templates/> <entitylist> <xsl:value-of select="//entity[success='false']/queid" separator=","/> </entitylist> </xsl:copy> </xsl:template>
Comments
Post a Comment