Subject: RE: [xsl] Entering invalid XML in XSLT or how to structure a rule? From: "Passin, Tom" <tpassin@xxxxxxxxxxxx> Date: Tue, 9 Sep 2003 10:49:32 -0400 |
[Mary McRae] > > I have come across a situation where I need to be able to enter markup > that will be considered invalid in the XSLT file, but will result in > valid markup in my result file. > This is a good case to illuminate the switch to "xslt-think' from procedural thinking. > This is basically because WordML does not support nesting paragraphs, > yet many DTDs/schemas consider bulleted lists to be part of the > paragraph (as is grammatically/structurally correct). So if I have a > para that contains a bullist, I need to end the WordML para and then > start a new one for each list item; at the end of the list I need to > insert a WordML start para. > Your description here is incomplete, because you have only described one procedural way to approach the problem. In xslt terms, what you want to do is to find chunks of the input that can end up as different chunks in the output tree. Then you want to actually turn (transform) them into those output parts. Your WordML paragraph - let's say it has only one bulleted list - has three identifiable chunks as you describe it - 1) The part before the bulleted list 2) The list itself 3) The part after the list. Your task is to figure out how to specify each of those parts to the xslt processor. You do this by working out what conditions a node has to meet in order to be included. For example, the first part consists of all nodes after the start of the paragraph and before the start of the list. Once you have each part, it is easy to wrap it in a para element or whatever you want. There is no question of ever needing a non-wellformed fragment, and no need for any look ahead. To sum up, in xslt-think, you identify the parts of the input you are interested in, you decide how they should be transformed to the output, and then you write transform fragments that describe those things to the processor. The processor figures out the procedures to actually make it happen. The order of the results depends on the order of the source document and the order of instructions within the templates. I know that this post has been very general, but I am sure you will get detailed responses as well. It is easy to lose sight of the real principles, and maybe this post will help keep the details in perspective. Cheers, Tom P XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] choosing what to include , Thomas Chiverton | Thread | [xsl] Getting error in xalan !! (, Dipesh Khakhkhar |
[xsl] choosing what to include base, Thomas Chiverton | Date | RE: [xsl] Entering invalid XML in X, Mary McRae |
Month |