What is a "Preserve Code Block" and how do you insert one?

K

Keith B

I see a "Preserve Code Block" in some of the InfoPath code examples. What is
it, and how can I insert one into a form?

Thanks,

Keith
 
V

virgul

hi,

It's very simple when you put some extra XML code in the view.xsl and
after you make modification in design of infopath you extra code is
erase so have the possibility to put on your markup the tag :
mode="xd:preserve" and after that you can make every changes that you
want and infopath don't change this part of the code.

++
 
K

Keith B

Thanks for the explaination. I am using the Asset Tracking example to learn
how to accomplish some things that I need in my application. When I extract
the files for Asset Tracking, I see three XSL files named: view_1.xsl,
view_2.xsl, and view_3.xsl. I am interested in a close inspection of the xsl
code for a view named "Individual Asset Details." (view_3.xsl, I guess.)
Looking inside view_3.xsl, how can I determine what is contained in the
Preserve code block and what derived from the controls that are part of the
view, but not in the Preserve code block?

Thanks again,

Keith


"Greg Collins [InfoPath MVP]" <Greg.Collins_AT_InfoPathDev.com> wrote in
message A preserve code block allows you to write custom XSL which (for the most
part -- there are some known exceptions) InfoPath does not touch. This
allows you to create something more grand than what you can do from the
InfoPath designer.

To create a preserve code block, start by adding a Section control into the
view where you want the preserved code to appear. The field you bind the
section to should be purposely chosen, based on what you are planning to do,
not just randomly chosen.

In your XSL file, you change the mode="_nn" on both the xsl:apply-templates
and the xsl:template elements to read mode="xd:preserve"

At this point all changes to the preserve code block will have to be
manually made in the XSL as InfoPath will not let you make them inside the
designer.

Does this help?

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



I see a "Preserve Code Block" in some of the InfoPath code examples. What is
it, and how can I insert one into a form?

Thanks,

Keith
 
K

Keith B

Please substitue view_2 for view_3 in my earlier question.

"Greg Collins [InfoPath MVP]" <Greg.Collins_AT_InfoPathDev.com> wrote in
message A preserve code block allows you to write custom XSL which (for the most
part -- there are some known exceptions) InfoPath does not touch. This
allows you to create something more grand than what you can do from the
InfoPath designer.

To create a preserve code block, start by adding a Section control into the
view where you want the preserved code to appear. The field you bind the
section to should be purposely chosen, based on what you are planning to do,
not just randomly chosen.

In your XSL file, you change the mode="_nn" on both the xsl:apply-templates
and the xsl:template elements to read mode="xd:preserve"

At this point all changes to the preserve code block will have to be
manually made in the XSL as InfoPath will not let you make them inside the
designer.

Does this help?

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



I see a "Preserve Code Block" in some of the InfoPath code examples. What is
it, and how can I insert one into a form?

Thanks,

Keith
 
K

Keith B

I found the reference to xd:preserve in the view_2.xsl file. Thanks

Keith

"Greg Collins [InfoPath MVP]" <Greg.Collins_AT_InfoPathDev.com> wrote in
message A preserve code block allows you to write custom XSL which (for the most
part -- there are some known exceptions) InfoPath does not touch. This
allows you to create something more grand than what you can do from the
InfoPath designer.

To create a preserve code block, start by adding a Section control into the
view where you want the preserved code to appear. The field you bind the
section to should be purposely chosen, based on what you are planning to do,
not just randomly chosen.

In your XSL file, you change the mode="_nn" on both the xsl:apply-templates
and the xsl:template elements to read mode="xd:preserve"

At this point all changes to the preserve code block will have to be
manually made in the XSL as InfoPath will not let you make them inside the
designer.

Does this help?

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



I see a "Preserve Code Block" in some of the InfoPath code examples. What is
it, and how can I insert one into a form?

Thanks,

Keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top