Subject: Re: [xsl] Removing line-feeds on a imported tree via document From: António Mota <amsmota@xxxxxxxxx> Date: Wed, 26 Jan 2005 14:50:15 +0000 |
Hi Michael: That was the second try i've done, but it did not work because, as far as i can tell, the MenuData nodes i want to normalize-space to are being "imported" by using <xsl:variable name="xmldoc" select="document($xmluri)"/> so they aren't in the original tree and it seems that the <xsl:template match="MenuData"> doesn't match then. Or should they being matched? On Tue, 25 Jan 2005 23:22:49 -0000, Michael Kay <mike@xxxxxxxxxxxx> wrote: > The xsl:copy-of instruction is only useful where you want to do an exact > copy. The standard way to do a transformation where the output is nearly the > same as the input is to start with the identity template rule: > > <xsl:template match="*"> > <xsl:copy> > <xsl:copy-of select="*"/> > <xsl:apply-templates/> > </xsl:copy> > </xsl:template> > > and then override it for elements that need to be modified: > > <xsl:template match="MenuData"> > <xsl:copy> > <xsl:value-of select="normalize-space(.)"/> > </xsl:copy> > </xsl:template> > > Michael Kay > http://www.saxonica.com/ > > > > -----Original Message----- > > From: Antsnio Mota [mailto:amsmota@xxxxxxxxx] > > Sent: 25 January 2005 19:12 > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > Subject: [xsl] Removing line-feeds on a imported tree via document > > > > Here's another interesting one. In my XSLT i have at some point > > > > <xsl:copy-of select="$xmldoc/Menus/Menu" /> > > > > working ok, EXCEPT sometimes i get things like > > > > <Menu> > > <Menu_K>X00066</Menu_K> > > <Titulo>(Cada Utente)</Titulo> > > <MenuData>SELECT Utente_K, NomeLogin > > FROM Utente > > WHERE UtenteTipo='U'</MenuData> > > <MenuTipo>TXT</MenuTipo> > > </Menu> > > > > Notice the line breaks on MenuData, that is causing me problems later > > on. So i want to get rid of then. I've tryed using > > > > <xsl:copy-of select="normalize-space($xmldoc/Menus/Menu)" /> > > > > because i don't understand nothing of this, but soon realise the > > error, so i went back and define a template > > > > <xsl:template match="MenuData"> > > <xsl:copy><xsl:value-of > > select="normalize-space(.)"/></xsl:copy> > > </xsl:template> > > > > but did no good, cause it seems that only match the original MenuDatas > > and not the imported ones. > > > > Any sugestions? Thanks.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Removing line-feeds on a , Michael Kay | Thread | Re: [xsl] Removing line-feeds on a , David Carlisle |
Re: [xsl] bizzare number problem, tom . kirkpatrick | Date | Re: [xsl] Removing line-feeds on a , David Carlisle |
Month |