troubleshooting Question

Help Understanding XSLT File

Avatar of thenthorn1010
thenthorn1010Flag for United States of America asked on
HTMLXMLASP.NET
3 Comments1 Solution332 ViewsLast Modified:
I am new to web development, and I am attempting to figure out why the code below is showing a blank page randomly. I have tried to read through the filters on the page in the conditions, but I am unable to figure out why the page is not displaying a blank page randomly. Is there a default filter on the page that makes the XSL not appear? (This is the first time I have gotten the chance to work with XSL files, and I am still have a novice understanding of XSL.) Any help is greatly appreciated.

<?xml version='1.0' encoding='utf-8' ?>
<xsl:stylesheet
	xmlns:s="http://www.w3.org/2001/XMLSchema"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:msxsl="urn:schemas-microsoft-com:xslt"
	xmlns:userx="urn:my-scripts"
	xmlns:foX="http://www.w3.org/TR/WD-xsl/FO"
	xmlns:fnX="http://www.w3.org/2002/08/xquery-functions"
	xmlns:fo="http://www.w3.org/1999/XSL/Format" 
	xmlns:xs="http://www.w3.org/2001/XMLSchema" 
	xmlns:fn="http://www.w3.org/2005/xpath-functions" 
	xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"
	version="2.0">

	<xsl:output method="html"/>

	<xsl:param name="Site">NOT_SET</xsl:param>
	<xsl:param name="Domain">NOT_SET</xsl:param>
	<xsl:param name="ProductLine">NOT_SET</xsl:param>
	
	<xsl:output method="html" omit-xml-declaration="yes"/>
	<xsl:decimal-format name="staff" digit="D" />
	<xsl:decimal-format NaN=""  name="CurrecnyFormat" decimal-separator="." grouping-separator="&#160;"/>

	<xsl:template match='/'>

		<xsl:if test='count(//Error) &gt; 0'>
			<center>
				<b>Contains Errors</b>
			</center>
		</xsl:if>
		<xsl:for-each select='//Error'>
			<!-- <xsl:value-of select="@Type" /> - <xsl:value-of select="@Message" /><br/>-->
		</xsl:for-each>

		<table style='font-family:arial;'>
			<tr>
				<td colspan="2" align="center">
					<img src="/foo/account/{$Domain}.gif"/>
				</td>
			</tr>
			<tr>
				<td >Dear foo,</td>
				<td align="right">
					<xsl:value-of select="substring-before(//RequestTempXML/@request_date,' ')"/>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					Please accept this letter as a temporary <xsl:call-template name ="CompanyName"/>  foo.
					<br/><br/>
					According to the information on file, the following individual(s) has <xsl:call-template name ="foobar"/>  foo:
				<br/><br/>
				</td>
			</tr>
			<tr>
				<td colspan="2">

					<div style="padding:10px;margin-bottom:15px;border-top:solid 1px black; border-left:solid 1px black;width:100%; margin-left:auto;margin:right;">
						<table width="100%">
							<tr>
								<td align="left" valign="top" width="65%">
									<xsl:if test="//Dependent [@DependentNumber=0]/@Name != ''">
										<b>Member:</b>&#32;<xsl:value-of select="//Dependent [@DependentNumber=0]/@Name" />
									</xsl:if>
									
									<ul>
										<xsl:if test="//foo/@bar != ''">
										<li>
											<b>foo bar:</b>&#32;<xsl:value-of select="//foo/@bar" />
										</li>
										</xsl:if>
										<xsl:if test="//foo/@a !=''">
										<li>
											<b>Group Number:</b>&#32;<xsl:value-of select="//foo/@a" />
										</li>
										</xsl:if>

										<xsl:if test="count(//ac [@Name !='']) &gt; 0">
											<li>
												<b>Type(s) of products available:</b>&#32;
												<xsl:for-each select="//availabeProducts [@Name !='']">
													<xsl:if test="position() > 1">,&#32;</xsl:if>
													<xsl:value-of select="@Name" />
													<xsl:if test="@Name=''">
														<xsl:value-of select="@Description" />
													</xsl:if>
													
												</xsl:for-each>
											</li>
										</xsl:if>
										<xsl:if test="count(//Copay) &gt; 0">
											<li>
												<b>Member data:</b>
												<br/>
												<ul>
												<xsl:for-each select="//Copay">
													<xsl:sort data-type ="number" select ="@Sequence"/>
													<xsl:if test="@Amount != '$0.00'">
														<li>
															<xsl:value-of select="@Amount" />
															&#10;<xsl:value-of select="@Detail" />
															
														</li>
													</xsl:if>
												</xsl:for-each>
												</ul>
											</li>
										</xsl:if>
									</ul>
								</td>
								<td  valign="top" width="35%">
									<xsl:if test="count(//Dependent) &gt; 0">
										<b>Dependents</b>
										<ul>
											<xsl:for-each select="//Dependent">
												<xsl:sort data-type ="number" select="DependentNumber"/>
												<li>
													<xsl:value-of select ="@Relationship" />: <xsl:value-of select ="(substring-before(@Name,' '))" />
												</li>
											</xsl:for-each>
										</ul>
									</xsl:if>
								</td>
							</tr>
							<tr>
								<td colspan="2">

									<!--
									<xsl:value-of select="count(//ac [@Name ='m'])" />
									<xsl:value-of select="count(//ac [@Name ='p'])" />
									<xsl:value-of select="count(//ac [@Name ='d'])" />
									<xsl:value-of select="count(//ac [@Name ='v'])" />
									-->


									<xsl:if test="//PhoneNumber [@Type='CustomerService']/@Number !=''">
										<b>Member Customer Service:</b>
										<xsl:value-of select="//PhoneNumber [@Type='CustomerService']/@Number"/>
									</xsl:if>

									
									<xsl:if test="count(//ac [@Name ='p']) &gt; 0  and //PhoneNumber [@Type='csd'][@Site=$Site]/@Number != ''">
										<br/>
										product: <xsl:value-of select="//PhoneNumber [@Type='product'][@Site=$Site]/@Number"/>
									</xsl:if>
									<xsl:if test="count(//ac [@Name ='v']) &gt; 0 and //PhoneNumber [@Type='csv']/@Number !=''">
										<br/>
										v: <xsl:value-of select="//PhoneNumber [@Type='csv']/@Number"/>
									</xsl:if>
									<xsl:if test="count(//ac [@Name ='d']) &gt; 0 and //PhoneNumber [@Type='csd']/@Number != ''">
										<br/>
										d: <xsl:value-of select="//PhoneNumber [@Type='csd']/@Number"/>
									</xsl:if>
								</td>
							</tr>
							
						</table>
					</div>

					<div style="padding:10px;margin-bottom:15px;border-top:solid 1px black; border-left:solid 1px black;width:100%; margin-left:auto;margin:right;">
						<table width="100%">
							<tr>
								<td>
									<b>foo:</b> Additional eligibility and benefits can be obtained by calling
									<xsl:value-of select="//PhoneNumber [@Type='fooInformation'][@Site=$Site]/@Number"/>
									or visiting foo.<xsl:value-of select="$Domain"/>.com.
									<br/>

									<xsl:if test="count(//Address [@Number=$Site] [@Type='pdi']) &gt; 0">
										<b>d:</b>
									
										<xsl:for-each select="//Address [@Number=$Site] [@Type='pdi']">
											<ul>
												<xsl:for-each select="./Line">
													<xsl:sort data-type ="number" select ="@Sequence" />
													<li>
														<xsl:value-of select="@Value"/>
													</li>
													
												</xsl:for-each>
											</ul>
										</xsl:for-each>
									</xsl:if>


									<xsl:if test="count(//Address [@Number=$Site] [@Type='ID']) &gt; 0">
										<b>Filling:</b>

										<ul>
											<xsl:for-each select="//Address [@Number=$Site] [@Type='ID']">
												<li>
													<i>:</i>
													<br/>
													<xsl:for-each select="./Line">
														<xsl:sort data-type ="number" select ="@Sequence" />

														ID:&#32;<xsl:value-of select="@Value"/>
														<br/>
													</xsl:for-each>
												</li>
											</xsl:for-each>
										</ul>
									</xsl:if>

									<xsl:if test="count(//Address [@Number=$Site] [@Type='MailYourSuff']) &gt; 0">
										<ul>
										<xsl:for-each select="//Address [@Number=$Site] [@Type='MailYourSuff']">
											<li>
												<i>Paper:</i>
												<br/>
												<xsl:for-each select="./Line">
													<xsl:sort data-type ="number" select ="@Sequence" />
													
														<xsl:value-of select="@Value"/>
													<br/>
												</xsl:for-each>
												</li>
										</xsl:for-each>
										</ul>
									</xsl:if>
									
									<b>Prior approval:</b> This must be obtained for the inpatient services<br/>
									<ul>
										<xsl:if test="//PhoneNumber [@Type='pp'][@Site=$Site]/@Number !=''">
											<li>
												m: <xsl:value-of select="//PhoneNumber [@Type='pp'][@Site=$Site]/@Number"/>
											</li>
										</xsl:if>
										<xsl:if test="//PhoneNumber [@Type='pp'][@Site=$Site]/@Number !=''">
											<li>
												h: <xsl:value-of select="//PhoneNumber [@Type='pp'][@Site=$Site]/@Number"/>
											</li>
										</xsl:if>
									</ul>
								</td>
							</tr>
						</table>
					</div>
					
				</td>
			</tr>
			<tr>
				<td colspan="2">
						Disclaimer -- removed
					</i> to order new ID cards for your family.
				</td>
			</tr>
			
		</table>
	</xsl:template>


	<xsl:template name="CompanyName">
		<xsl:choose>
			<xsl:when test="$Site = 'a'">company a</xsl:when>
			<xsl:when test="$Site = 'CLIC'">Another Company</xsl:when>
			<xsl:when test="$Site = 'CCP'">Blah Care Plan</xsl:when>
			<xsl:otherwise>Not Set</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="cc">
		<xsl:choose>
			<xsl:when test="$Site = 'a'">company a</xsl:when>
			<xsl:when test="$Site = 'CLIC'">Another Company</xsl:when>
			<xsl:when test="$Site = 'CCP'">Blah Care Plan</xsl:when>
			<xsl:otherwise>Not Set</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="short-time">
		<xsl:param name="date" />
		<!-- YYYY-MM-DD HH:MM:SS +/-HHMM -->
		<xsl:value-of select="index-of($date,' ')"/>
		<xsl:value-of select="substring($date, 12, 8)" />
	</xsl:template>

</xsl:stylesheet>
ASKER CERTIFIED SOLUTION
Gertone (Geert Bormans)
Information Architect
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros