We help IT Professionals succeed at work.

Help Understanding XSLT File

thenthorn1010
on
328 Views
Last Modified: 2012-09-12
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>

Open in new window

Comment
Watch Question

Author

Commented:
Masteraco,

I have looked over this file format after reading over the basics, and I do not see anything that would cause the page not to appear. Is there a overall filter that would hide all of the information located on the page? I do not see one when I look over the page. Thanks.
Information Architect
CERTIFIED EXPERT
Top Expert 2006
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
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.