RE: [xsl] Entity inside an attribute

Subject: RE: [xsl] Entity inside an attribute
From: "Miller, Mark" <Mark.Miller@xxxxxxxxxxxxxxxx>
Date: Tue, 20 Apr 2010 13:33:59 -0400
I define ENTITYs for each piece of the content.  I then use parameters
in the xslt to place the content that has the characters that are giving
me problems.  This gives me the exact output needed to display the html
or jsp page properly.

Hope this helps,

<----xsl template--->
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE stylesheet [
<!ENTITY jspStart
"<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
disable-output-escaping='yes'>&lt;</xsl:text>" >

<!ENTITY jspEnd
"<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
disable-output-escaping='yes'>&gt;</xsl:text>" >

<!ENTITY jspCommentStart
"<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
disable-output-escaping='yes'>&lt;</xsl:text>" >

<!ENTITY jspCommentEnd
"<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
disable-output-escaping='yes'>&gt;</xsl:text>" >

<!ENTITY p0PlannedX
"<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
disable-output-escaping='yes'>chart.setProperty(&quot;dataset0dateValues
&quot;, &quot;</xsl:text>" >

<!ENTITY p0PlannedY
"<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
disable-output-escaping='yes'>chart.setProperty(&quot;dataset0yValues&qu
ot;, &quot;</xsl:text>" >

<!ENTITY p1ActualX
"<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
disable-output-escaping='yes'>chart.setProperty(&quot;dataset1dateValues
&quot;, &quot;</xsl:text>" >

<!ENTITY p1ActualY
"<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
disable-output-escaping='yes'>chart.setProperty(&quot;dataset1yValues&qu
ot;, &quot;</xsl:text>" >

<!ENTITY pEnd
"<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
disable-output-escaping='yes'>&quot;);</xsl:text>" >

<!ENTITY p2ActualX
"<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
disable-output-escaping='yes'>chart.setProperty(&quot;dataset2dateValues
&quot;, &quot;</xsl:text>" >

<!ENTITY p0Labels
"<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
disable-output-escaping='yes'>&lt;param name=&quot;dataset0Labels&quot;
value=&quot;</xsl:text>" >

<!ENTITY p1Labels
"<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
disable-output-escaping='yes'>&lt;param name=&quot;dataset1Labels&quot;
value=&quot;</xsl:text>" >

<!ENTITY p2Name
"<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
disable-output-escaping='yes'>chart.setProperty(&quot;dataset2Name&quot;
, &quot;</xsl:text>" >

<!ENTITY pAnnot0Label
"<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
disable-output-escaping='yes'>&lt;param
name=&quot;annotation0LabelString&quot; value=&quot;</xsl:text>" >

<!ENTITY pTitle
"<xsl:text xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
disable-output-escaping='yes'>&lt;param name=&quot;titleString&quot;
value=&quot;</xsl:text>" >

]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html" encoding="iso-8859-1"/>

<xsl:template match="ematrix/creationProperties"/>

<xsl:template match="ematrix/businessObject">

&jspStart;%@ page import = "com.ve.kavachart.servlet.*, java.util.*"
%&jspEnd;<xsl:text>
</xsl:text>
&jspStart;%@ page import = "com.ve.kavachart.chart.*,
com.ve.kavachart.utility.*" %&jspEnd;<xsl:text>
</xsl:text>
&jspStart;%@ page import = "com.ve.kavachart.servlet.*"
%&jspEnd;<xsl:text>
</xsl:text>

<html>
<body><xsl:text>
</xsl:text>
&jspCommentStart;%

	Bean chart = new dateLineApp();

chart.loadProperties(application.getRealPath("styles/riskWaterfallChart.
properties"));
    chart.setProperty("writeDirectory",
application.getRealPath("/images/KavaChartImages"));
	chart.setProperty("useCache", "false");
			<xsl:text>
			</xsl:text>
				&p2ActualX;
					<xsl:value-of
select="substring(/ematrix/creationProperties/datetime,1,10)"/><xsl:text
>,</xsl:text><xsl:value-of
select="substring(/ematrix/creationProperties/datetime,1,10)"/><xsl:text
>,</xsl:text>
				&pEnd;
			<xsl:text>
			</xsl:text>
				&p2Name;
					<xsl:value-of
select="substring(/ematrix/creationProperties/datetime,1,10)"/>
				&pEnd;
			<xsl:text>
			</xsl:text>
				&p0PlannedX;
						<xsl:for-each
select="fromRelationshipList/relationship[relationshipDefRef='Risk
RPN']">
						<xsl:sort
select="substring(relationshipDefRef/following-sibling::attributeList/at
tribute[name='RF Planned Effective Date']/datetime,1,4)"/> <!-- year -->
						<xsl:sort
select="substring(relationshipDefRef/following-sibling::attributeList/at
tribute[name='RF Planned Effective Date']/datetime,6,2)"/> <!-- month
-->
						<xsl:sort
select="substring(relationshipDefRef/following-sibling::attributeList/at
tribute[name='RF Planned Effective Date']/datetime,9,2)"/> <!-- day -->
						<xsl:choose>
						  <xsl:when
test="position() = 1">
							<xsl:value-of
select="substring(attributeList/attribute[name='RF Planned Effective
Date']/datetime,1,10)"/><xsl:text>,</xsl:text>
						  </xsl:when>
							<xsl:when
test="position() = last()">

<xsl:value-of select="substring(attributeList/attribute[name='RF Planned
Effective Date']/datetime,1,10)"/><xsl:text>,</xsl:text><xsl:value-of
select="substring(attributeList/attribute[name='RF Planned Effective
Date']/datetime,1,10)"/>
							</xsl:when>
						  <xsl:otherwise>
						  <xsl:value-of
select="substring(attributeList/attribute[name='RF Planned Effective
Date']/datetime,1,10)"/><xsl:text>,</xsl:text><xsl:value-of
select="substring(attributeList/attribute[name='RF Planned Effective
Date']/datetime,1,10)"/><xsl:text>,</xsl:text>
						  </xsl:otherwise>
						</xsl:choose>
					</xsl:for-each>
				&pEnd;
			<xsl:text>
			</xsl:text>
				&p1ActualX;
					<xsl:for-each
select="fromRelationshipList/relationship[relationshipDefRef='Risk
RPN']">
						<xsl:sort
select="substring(relationshipDefRef/following-sibling::attributeList/at
tribute[name='RF Planned Effective Date']/datetime,1,4)"/> <!-- year -->
						<xsl:sort
select="substring(relationshipDefRef/following-sibling::attributeList/at
tribute[name='RF Planned Effective Date']/datetime,6,2)"/> <!-- month
-->
						<xsl:sort
select="substring(relationshipDefRef/following-sibling::attributeList/at
tribute[name='RF Planned Effective Date']/datetime,9,2)"/> <!-- day -->
						<xsl:choose>
						  <xsl:when
test="position() = 1">
							<xsl:value-of
select="substring(attributeList/attribute[name='Effective
Date']/datetime,1,10)"/><xsl:text>,</xsl:text>
						  </xsl:when>
							<xsl:when
test="position() = last()">

<xsl:value-of select="substring(attributeList/attribute[name='Effective
Date']/datetime,1,10)"/><xsl:text>,</xsl:text><xsl:value-of
select="substring(attributeList/attribute[name='Effective
Date']/datetime,1,10)"/>
							</xsl:when>
						  <xsl:otherwise>
						  <xsl:value-of
select="substring(attributeList/attribute[name='Effective
Date']/datetime,1,10)"/><xsl:text>,</xsl:text><xsl:value-of
select="substring(attributeList/attribute[name='Effective
Date']/datetime,1,10)"/><xsl:text>,</xsl:text>
						  </xsl:otherwise>
						</xsl:choose>
					</xsl:for-each>
				&pEnd;
			<xsl:text>
			</xsl:text>
	            <xsl:text>   </xsl:text>&p0PlannedY;
					<xsl:for-each
select="fromRelationshipList/relationship[relationshipDefRef='Risk
RPN']">
						<xsl:sort
select="substring(relationshipDefRef/following-sibling::attributeList/at
tribute[name='RF Planned Effective Date']/datetime,1,4)"/> <!-- year -->
						<xsl:sort
select="substring(relationshipDefRef/following-sibling::attributeList/at
tribute[name='RF Planned Effective Date']/datetime,6,2)"/> <!-- month
-->
						<xsl:sort
select="substring(relationshipDefRef/following-sibling::attributeList/at
tribute[name='RF Planned Effective Date']/datetime,9,2)"/> <!-- day -->
						<xsl:choose>
							<xsl:when
test="position() = last()">

<xsl:value-of select="attributeList/attribute[name='Planned RPN
Value']/real"/>
							</xsl:when>
							<xsl:otherwise>

<xsl:value-of select="attributeList/attribute[name='Planned RPN
Value']/real"/><xsl:text>       ,</xsl:text><xsl:value-of
select="attributeList/attribute[name='Planned RPN
Value']/real"/><xsl:text>       ,</xsl:text>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:for-each>
				&pEnd;
			<xsl:text>
			</xsl:text>
				<xsl:text>   </xsl:text>&p1ActualY;
					<xsl:for-each
select="fromRelationshipList/relationship[relationshipDefRef='Risk
RPN']">
						<xsl:sort
select="substring(relationshipDefRef/following-sibling::attributeList/at
tribute[name='RF Planned Effective Date']/datetime,1,4)"/> <!-- year -->
						<xsl:sort
select="substring(relationshipDefRef/following-sibling::attributeList/at
tribute[name='RF Planned Effective Date']/datetime,6,2)"/> <!-- month
-->
						<xsl:sort
select="substring(relationshipDefRef/following-sibling::attributeList/at
tribute[name='RF Planned Effective Date']/datetime,9,2)"/> <!-- day -->
						<xsl:choose>
							<xsl:when
test="position() = last()">

<xsl:value-of select="attributeList/attribute[name='Actual RPN
Value']/real"/>
							</xsl:when>
							<xsl:otherwise>

<xsl:value-of select="attributeList/attribute[name='Actual RPN
Value']/real"/><xsl:text>       ,</xsl:text><xsl:value-of
select="attributeList/attribute[name='Actual RPN
Value']/real"/><xsl:text>       ,</xsl:text>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:for-each>
				&pEnd;
			<xsl:text>
			</xsl:text>
            chart.setProperty("fileName", "<xsl:value-of
select="objectName"/>_wf.PNG");
%&jspCommentEnd;<xsl:text>
</xsl:text>

&jspStart;img src=../images/KavaChartImages/&jspStart;%=
chart.getFileName() %&jspEnd;&jspEnd;<xsl:text>
</xsl:text>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


<---output--->
<%@ page import = "com.ve.kavachart.servlet.*, java.util.*" %>
<%@ page import = "com.ve.kavachart.chart.*, com.ve.kavachart.utility.*"
%>
<%@ page import = "com.ve.kavachart.servlet.*" %>
<html>
<body>
<%

	Bean chart = new dateLineApp();

chart.loadProperties(application.getRealPath("styles/riskWaterfallChart.
properties"));
    chart.setProperty("writeDirectory",
application.getRealPath("/images/KavaChartImages"));
	chart.setProperty("useCache", "false");

			chart.setProperty("dataset2dateValues",
"2010-04-20,2010-04-20,");
			chart.setProperty("dataset2Name", "2010-04-20");
			chart.setProperty("dataset0dateValues",
"2006-12-31,");
			chart.setProperty("dataset1dateValues",
"2006-12-31,");
			   chart.setProperty("dataset0yValues", "0.9");
			   chart.setProperty("dataset1yValues", "0.9");

            chart.setProperty("fileName", "B005_wf.PNG");
%>
<img src=../images/KavaChartImages/<%= chart.getFileName() %>>
</body>
</html>


Mark J. Miller
CDM - PLM
MEADS International, Inc.
P.O. Box 691749
200 Lockheed Martin Blvd.
Orlando, FL 32869-1749
407.356.7263


> -----Original Message-----
> From: Shashank Jain [mailto:shashankjain@xxxxxxxx]
> Sent: Tuesday, April 20, 2010 12:38 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Cc: mike@xxxxxxxxxxxx
> Subject: RE: [xsl] Entity inside an attribute
>
>
> Michael,
>
> Yes, I am using <xsl:output method="html"/>
>
> Shashank
>
> ----------------------------------------
> > From: mike@xxxxxxxxxxxx
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Date: Tue, 20 Apr 2010 17:32:19 +0100
> > Subject: RE: [xsl] Entity inside an attribute
> >
> >
> > disable-output-escaping has no effect when writing an attribute
> value.
> >
> > Are you using ?
> >
> > Regards,
> >
> > Michael Kay
> > http://www.saxonica.com/
> > http://twitter.com/michaelhkay
> >
> >
> >
> >> -----Original Message-----
> >> From: Shashank Jain [mailto:shashankjain@xxxxxxxx]
> >> Sent: 20 April 2010 17:26
> >> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >> Subject: [xsl] Entity inside an attribute
> >>
> >>
> >> Hello All,
> >>
> >> I am trying to create an HTML  tag with attribute
> >> title="=COUNTIF(A3:A13<>P)"
> >>
> >> But I am not able to get the greater than sign '>'.
> >> My output is coming as
> >>
> >> and I want
> >>
> >>
> >> Following code I am using to create the td tag.
> >>
> >>
> >>
> >>
> >> disable-output-escaping="yes">=COUNTIF(A3:A13
> >>           <
> >>          >P)
> >>
> >>
> >>
> >> I tried this one too in my XSL
> >>
> >>
> >>
> >>
> >> Please correct me where I am doing wrong.
> >>
> >> Thanks,
> >> Shashank
> >>
> >> _________________________________________________________________
> >> Hotmail is redefining busy with tools for the New Busy. Get
> >> more from your inbox.
> >> http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::
> >> T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
> >
>
> _________________________________________________________________
> Hotmail is redefining busy with tools for the New Busy. Get more from
> your inbox.
>
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL
> :ON:WL:en-US:WM_HMP:042010_2

Current Thread