xslt - getting all child nodes of element -
i have xml file on applying transformation specific element , try text() of child nodes ignoring same node
<xml> <xrefline> <query>eligible individual</query> in respect of qualified dependant @ time means person @ time <quote> <para> <n>(a)</n> <parap>resides qualified dependant,</parap> </para> </quote> </xrefline> </xml> my xslt template looks , want extract text() , preserve query element
<xsl:template match="query" > <xsl:apply-templates select="../text()|../node()[self::query]|../node()[not(self::query)]/text()" ></xsl:apply-templates> </xsl:template> my desire output should
<xml> <xrefline> <query>eligible individual</query> in respect of qualified dependant @ time means person @ time (a) resides qualified dependant, </xrefline> </xml> i have work around template match="query" , go desire result. above xslt getting text out side element quote not text of sub childs of quote element... or hint helpful.
i write 2 templates:
<xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* , node()"/> </xsl:copy> </xsl:template> <xsl:template match="xrefline//*[not(self::query)]"> <xsl:apply-templates/> </xsl:template>
Comments
Post a Comment