Subject: Re: [xsl] Re: Removing line-feeds on a imported tree via document From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 25 Jan 2005 16:39:16 -0500 |
... <xsl:apply-templates select="$xmldoc" mode="menu"/> ...
<xsl:template match="*" mode="menu"> <!-- copies any elements --> <xsl:copy> <xsl:apply-templates mode="menu"/> </xsl:copy> </xsl:template>
<xsl:template match="text()" mode="menu"> <!-- trims whitespace --> <xsl:value-of select="normalize-space(.)"/> </xsl:template>
Of course, it works by applying a modification of the identity transform to the node set you call in.
Cheers, Wendell
I've solved my problem but i would like a more elegant solution, if there is one...
Instead of having <xsl:variable name="xmldoc" select="document($xmluri)"/> <...> <xsl:copy-of select="$xmldoc/Menus/Menu" />
i have now
<xsl:variable name="xmldoc" select="document($xmluri)/Menus/Menu"/> <...> <Menu> <xsl:for-each select="$xmldoc/node()"> <xsl:copy><xsl:value-of select="normalize-space(.)"/></xsl:copy> </xsl:for-each> </Menu>
that do the trick, but somehow i didn't like it very much.
Any more sugestions? Thanks.
On Tue, 25 Jan 2005 19:11:50 +0000, Antsnio Mota <amsmota@xxxxxxxxx> wrote: > 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.
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Removing line-feeds on a , António Mota | Thread | Re: [xsl] Re: Removing line-feeds o, António Mota |
Re: [xsl] generic sort based on att, Joris Gillis | Date | [xsl] Modify the XSL output from H, samir sawant |
Month |