Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] applying templates to attribute value

From: Wendell Piez <wapiez@---------------->
To:
Date: 7/1/2008 3:35:00 PM
Mark,



At 05:18 PM 6/30/2008, you wrote:
In fact, the select statement was what I started out with, but 
changed it to apply-templates in order to have the content itself 
match on the <b> and <br />. Doesn't apply templates force further 
matching of the matched node? Instead I am still getting the 
attribute value, untransformed.

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.



This is entirely aside from the question of how you engineer a 
transform based on the pseudo-markup inside your attribute value.



The key to understanding both of these issues is in the data model. 
As Ken also said, the tree that XSLT takes as input does not render 
any structure inside attribute values, but treats them as simple text 
values. This is in accordance with XML, in which markup as such is 
prohibited inside attributes, which is why the "markup" you have is 
escaped with character references to markup delimiters. Whoever has 
designed your system has decided to ignore this design and pretend 
that markup inside attributes is as good as markup elsewhere, which it isn't.



Conservative XML designers always prefer elements when they need to 
represent structure. 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.



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
======================================================================


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