sacha74 Posted July 6, 2010 Share Posted July 6, 2010 Hello,I have a xml file and what I want to do is to copy the entire file with all the tags. I've done this with : <xsl:template match="node()"> <xsl:copy> <xsl:apply-templates select="node()"/> </xsl:copy></xsl:template> But I also want to replace all characters "ÁÉÍÓÚ" with"AEIOU". I managed to do this with : <xsl:variable name="Schar">ÁÉÍÓÚ</xsl:variable><xsl:variable name="Rchar">AEIOU</xsl:variable> <xsl:template match="node()"> <xsl:copy-of select="translate(normalize-space(.), $Schar, $Rchar)"></xsl:copy-of></xsl:template> The problem with this last code is that there are no more tags in the result file. But what Iwant is to combine the two features that are : copying the xml file while only changing the characters mentionned above.With an example, I would like that : <xml><table><ROW><CELL ROWSPAN="1" COLSPAN="1"><Tableau-cellule><A ID="pgfId-594128"></A>Ámbito </Tableau-cellule></CELL>......</ROW></table></xml> to become that : <xml><table><ROW><CELL ROWSPAN="1" COLSPAN="1"><Tableau-cellule><A ID="pgfId-594128"></A>Ambito </Tableau-cellule></CELL>......</ROW></table></xml> Can somebody telle me how to combine these two rules because when I tried to combine them , everytime one of two doesn't work. Thanks in advance for all the help I can find. Link to comment Share on other sites More sharing options...
Martin Honnen Posted July 6, 2010 Share Posted July 6, 2010 <xsl:template match="*"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy></xsl:template><xsl:template match="@*"> <xsl:attribute name="{name()}" namespace="{namespace-uri()}"> <xsl:value-of select="translate(., $Schar, $Rchar)"/> </xsl:attribute></xsl:template><xsl:template match="text()"> <xsl:value-of select="translate(., $Schar, $Rchar)"/></xsl:template><xsl:template match="comment() | processing-instruction()"> <xsl:copy/></xsl:template> Link to comment Share on other sites More sharing options...
sacha74 Posted July 6, 2010 Author Share Posted July 6, 2010 Once again thanks a lot for your answer, which works wonderfully. That's also really kind of you to answer so quickly.Thank you, Martin Honnen Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.