Adding and Removing Content

Some books talk about adding and removing content as if it were a significant topic. I think this orientation comes from dealing with result documents that look very similar to source documents, except for adding or subtracting a few Elements or Attributes. In our world this is almost never the case. Even if we are fortunate enough to have similar structures for the source and results trees, they will rarely if ever use the same Element and Attribute names. So, the concept of adding and removing content is somewhat foreign.

However, we do need to deal with these concepts at a very gross level. To add content to a result tree that wasn't in the source tree, we simply insert the appropriate XSLT Elements or literal result markup in the content of the appropriate xsl:template. This is exactly what we did with the first example. There are various ways to ensure that content in the source tree doesn't appear in the result tree. In the most common case, the only things that show up in the result tree are the Elements and Attributes for which we specifically ask, usually by using xsl:value-of. If we don't ask for something, by default it doesn't show up.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset