Just worte about this today:
creating a .css file for xml - SitePoint Forums
Code:
<xsl:stylesheet version='1.0'
xmlns:xsl="http://w3.org/1999/XSL/Transform"
xmlns="http://w3.org/1999/xhtml">
<xsl:output method="xml" ... />
</xsl:stylesheet>
is the way to do it. There is no output method=xhtml as I know of.
Quote:
Originally Posted by wige
My question is, how do I test for a false condition? <xsl:if test="@name"> will execute if there is an attribute called name, but how can I get it to execute if name does not exist? The same thing applies with comparing values. If I want to check if name is not Tom, @name != 'Tom' does not work.
|
Generally you use this
axis::node test [predicats]
structure while filtering node sets. So you need to know the following concepts to perform tests:
- Axes
- node test (name test / node type test)
- Predicates that filters the node set.
Quote:
Originally Posted by wige
Also, as part of the same issue, is there a way to get an XSL template to output an invalid tag? Basically, if an element is found without the specified tag, I want to output a closing tag, followed by a new opening tag. I am trying to create a new row in a table when this happens. However, the closing tag causes the file to no longer be valid XML, and it doesn't process. Do I need to use a CDATA container or something else?
|
CData shoul be able to do it. Depending on what you do (output method etc.) there can be problems with closing ?> etc. Last but not least, you need to know that white space (line feeds, carriage return, etc) may be interpreted different in various browsers. White space, you should know how that is handled from the very begining. It may be tricky.
Read more ...