![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Using xsl:if with xsl:value-of >Thread Next - Re: Using xsl:if with xsl:value-of Re: Using xsl:if with xsl:value-ofTo: NULL Date: 1/16/2008 12:04:00 AM You can use   instead of in XML   is the decimal code for a non-breaking space, which is identical to the entity (that is only defined by HTML DTD) There's no need to invoke CDATA and escaping here. If you do have problems with the input HTML parsing correctly, run the content through "Tidy" which has bindings for a range of languages including .NET : See http://tidy.sourceforge.net/ and this page for .NET specfic : http://users.rcn.com/creitzel/tidy.html#dotnet The default settings are almost always fine for general use. HTH Cheers - Neil On Tue, 15 Jan 2008 15:15:01 -0800, AlBruAn <albruan@h....(donotspam)> wrote: >I am using an open source HTML editor in an ASP.NET project to permit the >users to create templates for form letters. When the user chooses to save >the current template, I parse the HTML to create the XSL for populating the >letters and I write both the HTML and XSL to the database. Among the things >the user can do is incorporate a table in the form letter, inserting both >text and data in the table. To maintain borders around those cells that are >intentionally left empty in design mode, I replace the "<td> </td>" HTML >string with "<td><xsl:text >disable-output-escaping="yes"><![CDATA[ ]]></xsl:text></td>" since XSL >doesn't seem to like " ". > >The above works like a charm as long as there is data for all fields within >the table; if data for one field is missing, the border for that cell doesn't >match the borders of all the other cells in the table. So my question is >this: how can I go about using data in the cell if any is available or >replacing it with the disable-output-escaping statement as shown above? I >thought there might be a way of incorporating xsl:if along with xsl:value-of, >but I honestly don't know. Anyway... > >A portion of the XML I'm reading is as follows: ><entity> > <ProviderID>12345</ProviderID> > <ProviderName>Butcher Burns, MD</ProviderName> > <ClaimNumber>1Z3ED0999</ClaimNumber> > <DateOfService>12/01/2005</DateOfService> ></entity> ><entity> > <ProviderID>12346</ProviderID> > <ProviderName>Blades Messina, MD</ProviderName> > <ClaimNumber>1Z3EF0000</ClaimNumber> > <DateOfService></DateOfService> ></entity> > >A portion of the currently-existing XSL is listed below. The entire table >containing the following snippet is inside an xsl:for-each loop. ><tr> > <td align="right">Claim Number:</td> > <td><xsl:value-of select="ClaimNumber" /></td> > <td align="right">Date of Service:</td> > <td><xsl:value-of select="DateOfService" /></td> ></tr> > >In this case, I want the fourth cell to contain the Date of Service the >first time through the loop since the data is provided for that iteration. >On the second iteration, the fourth cell needs to contain "<td><xsl:text >disable-output-escaping="yes"><![CDATA[ ]]></xsl:text></td>" since Date of >Service data isn't provided for it. ------------------------------------------------ Digital Media MVP : 2004-2008 http://mvp.support.microsoft.com/mvpfaqs | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
