[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to copy attribute value to text?
On 07.07.2016 07:22, Kenneth Reid Beesley krbeesley@xxxxxxxxx wrote:
If I start with an input XML document that contains mixed text with <word> elements like this: Ibve tried matching the text() in a separate template, but I canbt seem to reference the attribute values of the parent node (i.e., <word>) of the text() and the parent nodebs attributes. E.g, the following doesnbt work for me, failing somehow in the select=b../@correctionb reference. You can use <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <xsl:template match="word[@correction]/text()"> <xsl:value-of select="../@correction"/> </xsl:template> <xsl:template match="word/@correction"> <xsl:attribute name="origerror" select=".."/> </xsl:template>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|