[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: can I *undefine* an attribute via xsl:attribute?
One cannot "undefine" an added attribute, but when I know I might
have to do so, I put the attributes in a temporary home and then work
from there.
I hope this helps. . . . . . Ken ~/t $ cat j.xsl <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:template match="/"> <output> <xsl:call-template name="create-my-attributes"/> </output> </xsl:template> <xsl:template name="create-my-attributes"> <xsl:variable name="attrs" as="element()"> <element> <xsl:call-template name="create-their-attributes"/> </element> </xsl:variable> <xsl:copy-of select="$attrs/@* except $attrs/@unwanted-attribute"/> </xsl:template> <xsl:template name="create-their-attributes"> <xsl:attribute name="a" select="'a'"/> <xsl:attribute name="unwanted-attribute" select="'z'"/> <xsl:attribute name="b" select="'b'"/> </xsl:template> </xsl:stylesheet>~/t $ xslt2 j.xsl j.xsl <?xml version="1.0" encoding="UTF-8"?><output a="a" b="b"/>~/t $ At 2020-08-01 15:04 +0000, Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx wrote: Hi all, -- Contact info, blog, articles, etc. http://www.CraneSoftwrights.com/s/ | Check our site for free XML, XSLT, XSL-FO and UBL developer resources | Streaming hands-on XSLT/XPath 2 training class @ US$45 (5 hours free) | Essays (UBL, XML, etc.) http://www.linkedin.com/today/author/gkholman |
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|