We help IT Professionals succeed at work.

Article Conversion using ColdFusion Logic

238 Views
Last Modified: 2013-12-16
I have to clean up all of our old articles and convert them to CSS, which entails getting rid of all of the tables and replacing them with div tags amongst other things.  I have a 'cleaner code' that I can put the article html though and pull out some of the problem areas.  What I haven't been able to do is find a way to close the <h2> tags or replace our current image code which looks like this:
 <div class="rightfig" style="width:250px;">
<img

src="http://www.thefabricator.com/Images/1585/rotary-bevel-head.jpg"

height="175" width="250" alt="Rotary bevel head"/>
<p><b>Figure 1</b>
<br />

</p>

</div>

With the tables that are in there now:

<table width="1" border="0" align="right">
  <tr>
    <td align="center" valign="top"><img src="http://www.thefabricator.com/Articles/Photos/1564/Fig2.jpg" /></td>
  </tr>
  <tr>
    <td align="center" valign="top" class="caption"><b>Figure 2</b><br />
      In vertical dereeler applications, individual coils<br />
      have to be loaded using hooks and slings. </td>
  </tr>
</table>

Here is the current code I am using to clean the articles:

<!---Pulls text from Article-Cleaner.cfm and formats based on parameters below--->

<cfset text = Form.Content>
 
<cfset text = Replace(text, "&rsquo;", "'", "All")>
<cfset text = Replace(text, "&ldquo;", """", "All")>
<cfset text = Replace(text, "&rdquo;", """", "All")>  
<cfset text = Replace(text, "&quot;", """", "All")>
<cfset text = Replace(text, "<br>", "", "All")>
<cfset text = Replace(text, "<span>", "", "All")>
<cfset text = Replace(text, "<p class=""bodysub"">", "<h2>", "All")>
<cfset text = Replace(text, "</li>", "</li>#chr(13)##chr(10)#", "All")>
<cfset text = Replace(text, "</p>", "</p>#chr(13)##chr(10)#", "All")>


<cfset cleantext = text>
Comment
Watch Question

CERTIFIED EXPERT

Commented:
Please post an example of your "before" (input) HTML code and your "after" (output) HTML code, as well post specifics about what should be replaced with what etc.

Author

Commented:
Here is a sample of an article that needs to be converted:


<p><i>Editor's Note: This article is Part III of a three-part series discussing finite element (FE) simulation for tool and process design in hot-stamping boron steel. Part I, which appeared in the December 2006 issue, discussed the types and applications of the hot-stamping process. Part II, which appeared in January 2007, discussed the microstructure of boron steels and coatings on the sheet surface. </i></p>

<p>This column was prepared by the staff of the Center for Precision Forming (CPF, formerly ERC for Net Shape Manufacturing), The Ohio State University, Taylan Altan, professor and director.</p>
<table width="1" border="0" align="center">
  <tr>
    <td align="center" valign="top"><img src="http://www.thefabricator.com/Articles/Photos/1557/Fig1.jpg" /></td>
  </tr>
  <tr>
    <td align="center" valign="top" class="caption"><b>Figure 1</b><br />
      The challenge in FE simulation is developing a material model that can accurately account for the interaction of the mechanical, thermal, and microstructural data.<sup>1</sup></td>
  </tr>
</table>
<p>Hot stamping comprises a forming process and then cooling the formed part within the die. Finite element (FE) simulation of hot stamping is currently under development. To model the hot-stamping process accurately, FE simulation needs to predict the mechanical, thermal, and microstructural changes in the workpiece (see <b>Figure 1</b>).  </p>
<table width="1" border="0" align="right">
  <tr>
    <td align="center" valign="top"><img src="http://www.thefabricator.com/Articles/Photos/1557/Fig2.jpg" /></td>
  </tr>
  <tr>
    <td align="center" valign="top" class="caption"><b>Figure 2</b><br />
      <b>2a </b>An isothermal FE analysis at 700 degrees C indicates the location of maximum thinning. <br />
    <b>2b</b> A thermomechanical simulation provides more accurate predictions, because it accounts for workpiece temperature gradients as well as the effect of forming speed.<sup>2</sup></td>
  </tr>
</table>
<p>Material data is needed over a range of forming temperatures (600 degrees C to 900 degrees C) and deformation rates to conduct reliable process simulations. Changing surface conditions during forming (such as formed scale on the sheet surface) significantly influence heat transfer as well as friction between the workpiece and tool. </p>
<p class="bodysub">  Forming Process Simulation</p>

<p>  Because forming a heated workpiece occurs quickly (forming speeds are approximately 500 mm per second), a simplified isothermal analysis could be made assuming no temperature changes occur during actual deformation. However, workpiece cooling in the die must be considered assuming that nearly all the cooling occurs after the part is hot-formed.</p>

<p>  <b>Figure 2a </b>shows results from an isothermal hot-forming FE simulation of a B-pillar. In an isothermal analysis, a single flow stress curve and friction coefficient are input to figure the finite element method (FEM). Temperature and the effect of forming speed are not accounted for.</p>
<p>  <b>Figure 2b </b>shows results for a thermomechanical FE simulation. This FE simulation considers the temperature gradients within the material, as well as the effect of forming speed and heat transfer between the tools and the workpiece. </p>
<p>  Microstructural changes, such as transformation to martensite, are not considered in this analysis. Research in predicting and modeling microstructural changes in a workpiece using FEM is in progress. <sup>2</sup>  </p>
<table width="1" border="0" align="right">
  <tr>
    <td align="center" valign="top"><img src="http://www.thefabricator.com/Articles/Photos/1557/Fig3a-b.jpg" width="280" height="175" /></td>
  </tr>
  <tr>
    <td align="center" valign="top" class="caption"><b>Figure 3a and 3b</b><br />
      Thermal FE analysis can predict punch and die temperature distribution during the cooling process.  Holes drilled in the die allow for faster cooling.</td>
  </tr>
</table>
<p class="bodysub">Cooling Process Simulation</p>
<p>  After the forming process is completed, the part must be cooled as quickly and homogeneously as possible. As discussed in the December 2006 issue, the hot-formed part is quenched within a closed die at a cooling rate of approximately 50 degrees C to 100 degrees C per second. </p>

<p>  Tool design is particularly critical during the cooling process. The die must absorb and dissipate a significant amount of heat energy through integrated cooling channels. Cooling channels should be designed to achieve a homogeneous distribution of mechanical properties in the formed part.</p>
<p>  Thermal FE analysis can assist tool designers in estimating temperature distribution within a workpiece and tool. <b>Figure 3a</b> and<b> Figure 3b</b> show the temperature distribution for two tools with different cooling channel designs. The die shown in <b>Figure 3a</b> has an additional drilling hole. A comparison of temperature distribution between two cooling designs shows that cooling capacity is improved by drilling an additional hole.<b> Figure 3c</b> illustrates a formed part's temperature distribution.  </p>

<table width="1" border="0" align="right">
  <tr>
    <td align="center" valign="top"><img src="http://www.thefabricator.com/Articles/Photos/1557/Fig3c.jpg" /></td>
  </tr>
  <tr>
    <td height="30" align="center" valign="top" class="caption"><b>Figure 3c</b><br />
    FE analysis can predict temperatures in a formed part, so cycle time for hot stamping can be estimated. <sup>3</sup></td>
  </tr>
</table>
<p>An insufficient cooling rate because of poor tool design can be predicted and corrected using FE simulation. Besides temperature distribution, thermal FE analysis also can be used to predict the cycle time required to cool a part to approximately 150 degrees C. At this temperature, a part can be safely withdrawn from the die. Thus, a controlled and optimized hot-stamping process can be developed with FE analysis. <sup>3</sup></p>
<p>  Until now most of the research related to FE simulation of hot stamping has been done in Europe. However, the Center for Precision Forming (formerly ERC/NSM) also is conducting warm-forming simulations. The CPF also has extensive experience in the simulation and modeling of hot- and warm-forging processes, which are similar to hot stamping.</p>
<p><i>Taylan Altan is a professor and director of the Center for Precision Forming (formerly Engineering Research Center for Net Shape Manufacturing), 339 Baker Systems, 1971 Neil Ave., Columbus, OH 43210-1271, 614-292-9267, www.cpforming.org. The CPF conducts research and development; educates students; and organizes workshops, tutorials, and conferences for the industry in stamping, tube hydroforming, forging, and machining.</i></p>
<p><i>Notes</i></p>
<p><i> 1. T. Tröster and W. Rostek, "Advanced Hot Forming," in proceedings from The International Conference "New Development in Sheet Metal Forming Technology," Stuttgart, Germany, 2004, pp. 49-63. </i></p>
<p><i> 2.  P. Hein, R. Kefferstein, and Y. Dahan, "Hot Stamping of USIBOR 1500P: Part and Process Analysis Based on Numerical Simulation," in proceedings from The International Conference "New Development in Sheet Metal Forming Technology," Stuttgart, Germany, 2006, pp. 163-175.</i></p>
<p><i>3. H. Engels, O. Schalmin, and C. Müller-Bollenhagen, "Controlling and Monitoring of the Hot-Stamping Process of Boron-Alloyed Heat-Treated Steels,"; in proceedings from The International Conference "New Development in Sheet Metal Forming Technology," Stuttgart, Germany, 2006, pp. 135-150. </i></p>

Here is what the article should look like after cleaned:

 <p>Editor's Note: This article is Part III of a three-part series discussing finite element (FE) simulation for tool and process design in hot-stamping boron steel. Part I, which appeared in the December 2006 issue, discussed the types and applications of the hot-stamping process. Part II, which appeared in January 2007, discussed the microstructure of boron steels and coatings on the sheet surface. </p>
 
 <div class="centerfig" style="width:400px;">
<img

src="http://www.thefabricator.com/Images/1557/fe-simulation-table.jpg"

height="121" width="400" alt="FE Simulation Table"/>
<p><b>Figure 1</b>
<br />
The challenge in FE simulation is developing a material model that can accurately account for the interaction of the mechanical, thermal, and microstructural data.<sup>1</sup>
</p>
</div>

<p>This column was prepared by the staff of the Center for Precision Forming (CPF, formerly ERC for Net Shape Manufacturing), The Ohio State University, Taylan Altan, professor and director.</p>



<p>Hot stamping comprises a forming process and then cooling the formed part within the die. Finite element (FE) simulation of hot stamping is currently under development. To model the hot-stamping process accurately, FE simulation needs to predict the mechanical, thermal, and microstructural changes in the workpiece (see <b>Figure 1</b>).  </p>



<p>Material data is needed over a range of forming temperatures (600 degrees C to 900 degrees C) and deformation rates to conduct reliable process simulations. Changing surface conditions during forming (such as formed scale on the sheet surface) significantly influence heat transfer as well as friction between the workpiece and tool. </p>

<h2>  Forming Process Simulation</h2>

 <div class="rightfig" style="width:300px;">
<img

src="http://www.thefabricator.com/Images/1557/isothermal-fe-analysis.jpg"

height="259" width="300" alt="Isothermal FE analysis"/>
<p><b>Figure 2</b>
<br />
2a An isothermal FE analysis at 700 degrees C indicates the location of maximum thinning.
2b A thermomechanical simulation provides more accurate predictions, because it accounts for workpiece temperature gradients as well as the effect of forming speed.<sup>2</sup>
</p>

</div>

<p>  Because forming a heated workpiece occurs quickly (forming speeds are approximately 500 mm per second), a simplified isothermal analysis could be made assuming no temperature changes occur during actual deformation. However, workpiece cooling in the die must be considered assuming that nearly all the cooling occurs after the part is hot-formed.</p>


<p>  <b>Figure 2a </b>shows results from an isothermal hot-forming FE simulation of a B-pillar. In an isothermal analysis, a single flow stress curve and friction coefficient are input to figure the finite element method (FEM). Temperature and the effect of forming speed are not accounted for.</p>

<p>  <b>Figure 2b </b>shows results for a thermomechanical FE simulation. This FE simulation considers the temperature gradients within the material, as well as the effect of forming speed and heat transfer between the tools and the workpiece. </p>

<p>  Microstructural changes, such as transformation to martensite, are not considered in this analysis. Research in predicting and modeling microstructural changes in a workpiece using FEM is in progress. <sup>2</sup>  </p>



<h2>Cooling Process Simulation</h2>

<p>  After the forming process is completed, the part must be cooled as quickly and homogeneously as possible. As discussed in the December 2006 issue, the hot-formed part is quenched within a closed die at a cooling rate of approximately 50 degrees C to 100 degrees C per second. </p>

 <div class="rightfig" style="width:280px;">
<img

src="http://www.thefabricator.com/Images/1557/thermal-fe-analysis.jpg"

height="175" width="280" alt="Thermal FE analysis"/>
<p><b>Figure 3a & 3b</b>
<br />
Thermal FE analysis can predict punch and die temperature distribution during the cooling process. Holes drilled in the die allow for faster cooling.
</p>

</div>

<p>  Tool design is particularly critical during the cooling process. The die must absorb and dissipate a significant amount of heat energy through integrated cooling channels. Cooling channels should be designed to achieve a homogeneous distribution of mechanical properties in the formed part.</p>

<p>  Thermal FE analysis can assist tool designers in estimating temperature distribution within a workpiece and tool. <b>Figure 3a</b> and<b> Figure 3b</b> show the temperature distribution for two tools with different cooling channel designs. The die shown in <b>Figure 3a</b> has an additional drilling hole. A comparison of temperature distribution between two cooling designs shows that cooling capacity is improved by drilling an additional hole.<b> Figure 3c</b> illustrates a formed part's temperature distribution.  </p>

 <div class="rightfig" style="width:280px;">
<img

src="http://www.thefabricator.com/Images/1557/fe-analysis.jpg"

height="150" width="280" alt="FE analysis"/>
<p><b>Figure 3c</b>
<br />
FE analysis can predict temperatures in a formed part, so cycle time for hot stamping can be estimated.<sup>3</sup>
</p>

</div>

<p>An insufficient cooling rate because of poor tool design can be predicted and corrected using FE simulation. Besides temperature distribution, thermal FE analysis also can be used to predict the cycle time required to cool a part to approximately 150 degrees C. At this temperature, a part can be safely withdrawn from the die. Thus, a controlled and optimized hot-stamping process can be developed with FE analysis. <sup>3</sup></p>


<p>  Until now most of the research related to FE simulation of hot stamping has been done in Europe. However, the Center for Precision Forming (formerly ERC/NSM) also is conducting warm-forming simulations. The CPF also has extensive experience in the simulation and modeling of hot- and warm-forging processes, which are similar to hot stamping.</p>

<p>Taylan Altan is a professor and director of the Center for Precision Forming (formerly Engineering Research Center for Net Shape Manufacturing), 339 Baker Systems, 1971 Neil Ave., Columbus, OH 43210-1271, 614-292-9267, www.cpforming.org. The CPF conducts research and development; educates students; and organizes workshops, tutorials, and conferences for the industry in stamping, tube hydroforming, forging, and machining.</p>

<div class="sidebar">
<h2>Notes:</h2>

<ol>
<li>T. Tröster and W. Rostek, "Advanced Hot Forming," in proceedings from The International Conference "New Development in Sheet Metal Forming Technology," Stuttgart, Germany, 2004, pp. 49-63. </li>

<li>P. Hein, R. Kefferstein, and Y. Dahan, "Hot Stamping of USIBOR 1500P: Part and Process Analysis Based on Numerical Simulation," in proceedings from The International Conference "New Development in Sheet Metal Forming Technology," Stuttgart, Germany, 2006, pp. 163-175.</li>

<li>H. Engels, O. Schalmin, and C. Müller-Bollenhagen, "Controlling and Monitoring of the Hot-Stamping Process of Boron-Alloyed Heat-Treated Steels,"; in proceedings from The International Conference "New Development in Sheet Metal Forming Technology," Stuttgart, Germany, 2006, pp. 135-150. </li>
</ol>
</div>


All of the tables that are holding images are to be replaced with <div> tags  all <p class="bodysub"> need to be replaced with <h2> and </h2> tags. The code we have does most of this already. What we haven't been able to do is:

put the ending </h2> tags on, or remove the tables and replace with <div> code.
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT

Commented:
From your before and after examples it's not clear how the table replacements are to be done.
CERTIFIED EXPERT

Commented:
Thanks for the question and the points.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.