Iterating thru XSL altchunk References in a for-each Loop--Converting InfoPath Repeating Control to Word .docx RRS feed

  • Question

  • Hi All,

    I have everything working well with the C# code behind a Convert to Word (2007) button in an MS Office InfoPath 2007 form. All the Word 2007 .zip package components are included, as expected, even chunks of the XHTML data from three rich text boxes that reside in .txt files in the root of the package. Two of these InfoPath controls are properly rendered, at run time, in separate locations within the document.xml with the use of the aFchunk-related tags (e.g.):

    <w:altChunk r:id="rId11">
    <w:altChunkPr w:val="off="/>

    The third rich text box, in the InfoPath form, is embedded within a repeating control (i.e., a repeating section, though it could just as easily apply to a repeating table control). For this control, two or more chunks (with their associated .txt files) are generated with a C# while loop, based on the number of data-entry repetitions for that field. For sake of example, consider active customers (<= 20) and the rich text field containing a bulleted list describing consultancy activities.

    I have attempted to transform the repeating chunks of XHTML data, stored in the multiple text files, with ids in the document.xml.rels file ranging from rId13, to as high as rId32. Using a for-each loop in the main template (match=”/”), I have tried to apply example "counter" approaches, but now understand that this 'violates the XSLT mentality.' My latest attempts have used recursion, but I do not seem to have that working correctly—I seem to be hanging when I call a named template to perform the recursion. I read that the use of xsl:number and position() may be preferable, but it is hard to grasp in the context of needing to reference the succeeding .txt files in the root of the Word package (my lack of understanding how to reference those nodes; e.g., is it the document() function?), or the ids in the document.xml.rels file.


    I have another fundamental request for a technique to debug/trace the xsl with breakpoints in order to see what is taking place and the values assigned at various locations in the processing of a .docx being rendered.  I work in the vs2005 environment and find the resident xsl debugging tool techniques all but useless.  Do you have any recommendations.  You can tell that I know just enough about this to be somewhat conversant, but am really at the beginning of my XML/XSL learning curve.

    Any guidance, or better yet, a concrete example, would be most appreciated.



    Monday, March 17, 2008 2:44 PM