Subject: Re: [xsl] applying templates to attribute value From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 01 Jul 2008 14:11:51 -0400 |
> Actually, as Ken said, to write the attribute value you should use > xsl:value-of. xsl:apply-templates should not work: if it does, your > processor is not being conformant, and your code will break in > another processor.
actually the default template for attributes does the same as value-of in this case.
<xsl:template match="@*"> <xsl:apply-templates/> </xsl:template>
<xsl:template match="*"> <xsl:apply-templates select="@*/> </xsl:template>
> Sometimes they bend the rules and introduce some > sort of structure into attribute values, but when they do, it's > always simple enough to parse easily (for example tokenized values, > or maybe tokenized values with labels), since this generally has to > be done in the application not by the XML parser.
Of course it is possible to parse reasonably complicated "quoted html in attributes" just using xslt if you want to avoid extension functions. Just bash the attribute value with enough regular expressions and generate some element nodes... (see htmlparse.xsl for some examples of this).
Cheers, Wendell
====================================================================== 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 -> |
---|---|---|
Re: [xsl] applying templates to att, Wendell Piez | Thread | Re: [xsl] applying templates to att, David Carlisle |
Re: [xsl] Re: OOXML, Dimitre Novatchev | Date | [xsl] Truncated text string, relati, Michael Dango |
Month |