Subject: RE: [xsl] Adding prefix to elements when I import a XML file From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Wed, 31 Oct 2007 10:35:56 -0000 |
xsl:copy-of will always make an exact copy. Once you need to make a modified copy, you need to do a recursive copy of the tree by transforming the nodes found at every level. XSLT makes this easy for you: <xsl:template match="*"> <xsl:element name="xed:{local-name}" namespace="(the new element namespace)"> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:element> </xsl:template> Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: La RKO [mailto:la_rko@xxxxxxxx] > Sent: 31 October 2007 09:48 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] Adding prefix to elements when I import a XML file > > Suppose that I want to import a xml file into another file. > > The file that I want to import is like: > > <document> > <head>this is a headline</head> > <text>this is the text</text> > <caption>this is the caption</caption> > </document> > > to do that I use copy-of-select=document(file.xml)... > and it works fine. > > But I want at the same time to add a prefix to some of the > tags of the imported file, in order to have a output like: > > <document> > <xed:head>this is a headline</xed:head> > <xed:text>this is the text</xed:text> > <xed:caption>this is the caption</xed:caption> </document> > > My question is how can I do that? Import and transforming at > the same time? > > Thanks in advance, > > Virginia > > > > ______________________________________________ > Pregunta, Responde, Descubre. > Comparte tus consejos y opiniones con los usuarios de Yahoo! > Respuestas http://es.answers.yahoo.com/info/welcome
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Adding prefix to elements, Abel Braaksma | Thread | [xsl] Accessing External Java Libra, Carl Bourne |
Re: [xsl] Adding prefix to elements, Abel Braaksma | Date | RE: [xsl] Q re Fo internal linking , Khaled Aly |
Month |