[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] alphabetic counters
Subject: RE: [xsl] alphabetic counters From: "Passin, Tom" <tpassin@xxxxxxxxxxxx> Date: Mon, 10 May 2004 15:18:35 -0400 |
> From: Nicholas Shanks [mailto:contact@xxxxxxxxxxxxxx] > Well thanks guys! Due to learning about {} and replacing all that > xsl:text crap I reduced my stylesheet from 18,705 to 15,196 > bytes. But I still have some CDATA and escaping going on. > This occurs when > creating table rows: > ... > > But outputting nodes within an xml:if and closing them within another > causes parse errors in Libxslt and Sablotron. > That is because your stylesheet has to be well-formed xml. It has noting to do with libxslt and Sablotron. That you think you need to close an xsl:if in another place should be a hint to you that you have not yet understood what you need to accomplish in xslt terms. It is as close to certain as a thing can be that you do not need to use tricks like that here. You just need to start thinking in terms of taking a set of nodes and operating on them, rather than in terms of spitting out bits and pieces in order. In xslt, the serialized ordering come at the end, after everything has been built (and in some cases the result is never serialized, in which case those things you are doing won't work anyway). So you need to process either a complete row or a complete cell within one template (of course it can call or apply other templates). Here's an example - <xsl:template match = '...'> <row> <xsl:apply-templates select='whatever/you need/to/select'/> </row> </xsl:template> If you don't want a row to be processed, do that at the point where you invoke this template, so that it will not be applied for rows you do not want. The same for the cells. This way you always have well-formed xml, because you are creating a node for the result tree. > The key approach from Michael Key didn't seem to work from > just copying > and pasting, but I will read the docs on keys and see if i can fix it. > Keys are good but can be a little tricky to get the hang of. Read some more, and try to create a simple test case you can experiment with until you get used to them. > I'm using Libxslt and Sablotron - Saxon and Xalan-J cannot parse the > xsl file properly, so I am not bothering with them. BZZZT! WRONG ANSWER! Saxon and Xalan are as close to being gold standards as you will get in this area. If they will not "parse" the xslt file, you have something wrong with it and you should correct it, not work around it. However, is it literally a "parse" problem? That would mean a non-well-formed XML file, which should not parse with the software you are using either. Or is it a problem with an xslt construction? If so, and if you cannot quite understand the error message (which is pretty common), try several processors because they will all give different error messages. You definitely need to find out whether you have an xml problem or an xslt problem. Cheers, Tom P
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] alphabetic counters, Andreas L. Delmelle | Thread | Re: [xsl] alphabetic counters, John-Mark Gurney |
[xsl] evaluate() error variable has, davidpbrown | Date | [xsl] problem: recursive templates , poppe chris |
Month |