![]() |
![]() | ![]() | ![]() | 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-ofTo: NULL Date: 1/16/2008 6:26:00 AM I finally figure it out using a combination of xsl:choose, xsl:when and xsl:otherwise in conjunction with the xsl:value-of statements. Thanks again for your suggestion on replacing the CDATA string with &160, Neil; it makes for much cleaner code. -- Things are more like they are now than they ever have been before. "AlBruAn" 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. > > > -- > Things are more like they are now than they ever have been before. | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
