Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: CHANGE AN XSL FROM A WEB PAGE

From: "Oleg Tkachenko [MVP]" <oleg@--_!----!_------!---------.--->
To: NULL
Date: 10/5/2004 8:16:00 PM
Siu wrote:

> I have to develop a web page which is able to change an xsl or the xml tags 
> and not the contents. For example: this is an xml file
> 
> <location>
>  <building>
>   <office>
>    <printer>
>    </printer>
>    <printer>
>    </printer>
>    <printer>
>    </printer>
>   </office>
>  </building>
> </location>
> 
> From my web application I want my user to change the tag <printer> into 
> <PRINTER>. How can I devlop this web page in C# (.NET)?

The following XSLT stylesheet will change element names defined in $from 
parameter to a name defined in $to parameter, while preserving the rest 
as is:

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:param name="from" select="'printer'"/>
     <xsl:param name="to" select="'PRINTER'"/>
     <xsl:template match="@*|node()">
         <xsl:copy>
             <xsl:apply-templates select="@*|node()"/>
         </xsl:copy>
     </xsl:template>
     <xsl:template match="*">
         <xsl:choose>
             <xsl:when test="name()=$from">
                 <xsl:element name="{$to}" namespace="{namespace-uri()}">
                     <xsl:apply-templates select="@*|node()"/>
                 </xsl:element>
             </xsl:when>
             <xsl:otherwise>
                 <xsl:copy>
                     <xsl:apply-templates select="@*|node()"/>
                 </xsl:copy>
             </xsl:otherwise>
         </xsl:choose>
     </xsl:template>
</xsl:stylesheet>

And for developing web pages using C# ask in more appropriate newsgroup.

-- 
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent