[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Adding Prefixes to Elements


Subject: RE: [xsl] Adding Prefixes to Elements
From: Jonathan Marenus <jonathanmarenus@xxxxxxxxx>
Date: Mon, 7 Mar 2005 15:14:22 -0800 (PST)

Ok, I wrote a stylesheet to transform the XSL file and
it works, Thanks!

The only problem is that it aligns everything to the
left margin in the output, even when I do indent="yes"
in the output method.  I want the alignment, spacing,
and indentation to be exactly like it was in the
original xsl file.

--- Aron Bock <aronbock@xxxxxxxxxxx> wrote:
> >>>
> >In XMLSpy, how would I go about automatically
> adding
> >prefixes to every element name in my XSL
> stylesheet.
> >For example, when I have a template match="A/B/C",
> I
> >would like it to change to x:A/x:B/x:C.
> 
> Any suggestions?
> <<<
> 
> Jonathan, if XMLSpy doesn't offer this feature and
> you don't find an editor 
> that does, perhaps it wouldn't be too difficult to
> write an XSL transform to 
> accomplish this?
> 
> From Sal Mangano's "XSLT Cookbook", the following is
> what he calls an 
> "identity transform"--one that simply copies input
> to output.
> 
> 
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 
> <xsl:template match="node(  ) | @*">
>   <xsl:copy>
>     <xsl:apply-templates select="@* | node(  )"/>
>   </xsl:copy>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> The idea, then, is to augment this with templates to
> transform what you 
> want.  For example, to [naively] prefix all "select"
> attributes with "x:", 
> you could add the following template:
> 
> <xsl:template match="@*[local-name() = 'select']">
>     <xsl:attribute name="select">
>     <xsl:value-of select="concat('x:', .)"/>
>     </xsl:attribute>
> </xsl:template>
> 
> Of course a realistic template would need to do more
> processing such as 
> splitting at "/" separators, recombining, etc.
> 
> Regards,
> 
> --A
> 
>
_________________________________________________________________
> FREE pop-up blocking with the new MSN Toolbar  get
> it now! 
>
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
> 
> 


	
		
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/


Current Thread
Keywords
xsl