alicia1234
asked on
What's wrong with this xslt - nothing is being displayed ...
Please refer to this previous post for a history of this problem, which was resolved there:
https://www.experts-exchange.com/questions/26890969/How-to-strip-out-only-the-p-tags-that-I-want.html
I am now trying to apply the same solution to a different XML and XSL file. The only difference is in the name of the tags. Nothing is being output.
I've attached both the XML and the XSL.
The XSL should be displaying:
the image that is within the <TaxonomyItemTeaser> tag; and
the two paragraphs of text within the <TaxonomyItemTeaser> tag
but none of it is being displayed.
The only thing that is being displayed is "<TaxonomyItemTitle>" and "<TaxonomyItemQuickLink>"
High points because I'm under a deadline. I am trying to modify existing xsl; I have no control over the xml. I'm new at this.
Thanks.
.
https://www.experts-exchange.com/questions/26890969/How-to-strip-out-only-the-p-tags-that-I-want.html
I am now trying to apply the same solution to a different XML and XSL file. The only difference is in the name of the tags. Nothing is being output.
I've attached both the XML and the XSL.
The XSL should be displaying:
the image that is within the <TaxonomyItemTeaser> tag; and
the two paragraphs of text within the <TaxonomyItemTeaser> tag
but none of it is being displayed.
The only thing that is being displayed is "<TaxonomyItemTitle>" and "<TaxonomyItemQuickLink>"
High points because I'm under a deadline. I am trying to modify existing xsl; I have no control over the xml. I'm new at this.
Thanks.
.
<TaxonomyData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TaxonomyId>4294967346</TaxonomyId>
<TaxonomyName>HR & Hiring</TaxonomyName>
<TaxonomyImage></TaxonomyImage>
<CategoryUrl></CategoryUrl>
<Visible>true</Visible>
<TaxonomyType>Content</TaxonomyType>
<TaxonomyLanguage>1033</TaxonomyLanguage>
<TaxonomyLanguageName>English (U.S.)</TaxonomyLanguageName>
<TaxonomyDescription></TaxonomyDescription>
<TaxonomyParentId>4294967341</TaxonomyParentId>
<TaxonomyLevel>2</TaxonomyLevel>
<TaxonomyPath>\Cost Savings\HR & Hiring</TaxonomyPath>
<TaxonomyCreatedDate>2011-03-14T14:48:01.62</TaxonomyCreatedDate>
<TaxonomyItemCount>1</TaxonomyItemCount>
<TaxonomyHasChildren>false</TaxonomyHasChildren>
<TemplateId>0</TemplateId>
<TemplateName></TemplateName>
<TemplateInherited>true</TemplateInherited>
<TemplateInheritedFrom>4294967341</TemplateInheritedFrom>
<TaxonomyItems>
<TaxonomyItemData>
<TaxonomyId>4294967346</TaxonomyId>
<ContentType></ContentType>
<TaxonomyItemStatus>Approved</TaxonomyItemStatus>
<ContentSubType>PageBuilderData</ContentSubType>
<TaxonomyLanguage>1033</TaxonomyLanguage>
<TaxonomyItemId>4294967391</TaxonomyItemId>
<TaxonomyItemLanguage>1033</TaxonomyItemLanguage>
<TaxonomyItemType>1</TaxonomyItemType>
<TaxonomyItemAddedUser>0</TaxonomyItemAddedUser>
<TaxonomyItemTitle>Test Program</TaxonomyItemTitle>
<TaxonomyItemTeaser>
<p>
<img src="/uploadedImages/CCA/Content/Forms/ADP_logo.gif" alt="ADP logo" title="ADP logo" />
</p>
<p> </p>
<p> </p>
<p>
This is a <strong>test program</strong> using the new template that gets the correct left-hand menu (<em>a list of categories</em>).
</p>
<p>This would be second paragraph.</p>
<p> </p>
</TaxonomyItemTeaser>
<TaxonomyItemQuickLink>/Test_Program.aspx</TaxonomyItemQuickLink>
<TaxonomyItemEditorLastName>Shea</TaxonomyItemEditorLastName>
<TaxonomyItemEditorFirstName>Alicia</TaxonomyItemEditorFirstName>
<TaxonomyItemDateModified>3/16/2011 11:24:05 AM</TaxonomyItemDateModified>
<TaxonomyItemDisplayDateModified>3/16/2011 11:24:05 AM</TaxonomyItemDisplayDateModified>
<TaxonomyItemDisplayDateCreated>3/15/2011 3:23:27 PM</TaxonomyItemDisplayDateCreated>
<TaxonomyItemThumbnail></TaxonomyItemThumbnail>
<TaxonomyItemImage></TaxonomyItemImage>
<TaxonomyItemHtml>
<PageData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="PB">
<IsMasterLayout>false</IsMasterLayout>
<masterID>0</masterID>
<pageID>4294967391</pageID>
<languageID>1033</languageID>
<title>Test Program</title>
<Widgets>
<WidgetData>
<ID xmlns="PW">40</ID>
<ControlURL xmlns="PW">ExternalContent.ascx</ControlURL>
<ColumnID xmlns="PW">0</ColumnID>
<Order xmlns="PW">0</Order>
<Minimized xmlns="PW">false</Minimized>
<Settings xmlns="PW"><ArrayOfDataStore xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><dataStore><Property>ContentID</Property><Value xsi:type="xsd:long">10737418633</Value><TypeName>System.Int64</TypeName><AssemblyAndType>System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyAndType></dataStore><dataStore><Property>FolderPath</Property><Value xsi:type="xsd:string">0</Value><TypeName>System.String</TypeName><AssemblyAndType>System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyAndType></dataStore></ArrayOfDataStore></Settings>
<DropID>Center</DropID>
<ColumnGuid>00000000-0000-0000-0000-000000000000</ColumnGuid>
<ChildColumns />
<KeyValues />
</WidgetData>
<WidgetData>
<ID xmlns="PW">10</ID>
<ControlURL xmlns="PW">ContentBlock.ascx</ControlURL>
<ColumnID xmlns="PW">0</ColumnID>
<Order xmlns="PW">0</Order>
<Minimized xmlns="PW">false</Minimized>
<Settings xmlns="PW"><ArrayOfDataStore xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><dataStore><Property>ContentBlockId</Property><Value xsi:type="xsd:long">4294967349</Value><TypeName>System.Int64</TypeName><AssemblyAndType>System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyAndType></dataStore><dataStore><Property>IsGoogleMultivariate</Property><Value xsi:type="xsd:boolean">false</Value><TypeName>System.Boolean</TypeName><AssemblyAndType>System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyAndType></dataStore><dataStore><Property>GoogleSectionName</Property><Value xsi:type="xsd:string"></Value><TypeName>System.String</TypeName><AssemblyAndType>System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyAndType></dataStore></ArrayOfDataStore></Settings>
<DropID>RightTop</DropID>
<ColumnGuid>00000000-0000-0000-0000-000000000000</ColumnGuid>
<ChildColumns />
<KeyValues />
</WidgetData>
</Widgets>
<Zones>
<DropZoneData>
<DropZoneID>LeftBottom</DropZoneID>
<isMasterZone>false</isMasterZone>
<Columns>
<ColumnData>
<Guid>00000000-0000-0000-0000-000000000000</Guid>
<Display>true</Display>
<columnID>0</columnID>
<width>100</width>
<unit>percent</unit>
</ColumnData>
</Columns>
</DropZoneData>
<DropZoneData>
<DropZoneID>Center</DropZoneID>
<isMasterZone>false</isMasterZone>
<Columns>
<ColumnData>
<Guid>00000000-0000-0000-0000-000000000000</Guid>
<Display>true</Display>
<columnID>0</columnID>
<width>100</width>
<unit>percent</unit>
</ColumnData>
</Columns>
</DropZoneData>
<DropZoneData>
<DropZoneID>CenterBottom</DropZoneID>
<isMasterZone>false</isMasterZone>
<Columns>
<ColumnData>
<Guid>00000000-0000-0000-0000-000000000000</Guid>
<Display>true</Display>
<columnID>0</columnID>
<width>0</width>
<unit>pixels</unit>
</ColumnData>
</Columns>
</DropZoneData>
<DropZoneData>
<DropZoneID>RightTop</DropZoneID>
<isMasterZone>false</isMasterZone>
<Columns>
<ColumnData>
<Guid>00000000-0000-0000-0000-000000000000</Guid>
<Display>true</Display>
<columnID>0</columnID>
<width>100</width>
<unit>percent</unit>
</ColumnData>
</Columns>
</DropZoneData>
<DropZoneData>
<DropZoneID>RightBottom</DropZoneID>
<isMasterZone>false</isMasterZone>
<Columns>
<ColumnData>
<Guid>00000000-0000-0000-0000-000000000000</Guid>
<Display>true</Display>
<columnID>0</columnID>
<width>100</width>
<unit>percent</unit>
</ColumnData>
</Columns>
</DropZoneData>
</Zones>
</PageData>
</TaxonomyItemHtml>
<TaxonomyItemObjectType>0</TaxonomyItemObjectType>
<TaxonomyItemFilePath>Test_Program.aspx</TaxonomyItemFilePath>
<TaxonomyItemFolderId>119</TaxonomyItemFolderId>
<TaxonomyItemGoLiveDate>0001-01-01T00:00:00</TaxonomyItemGoLiveDate>
<TaxonomyItemEndDate>0001-01-01T00:00:00</TaxonomyItemEndDate>
</TaxonomyItemData>
</TaxonomyItems>
<Taxonomy></Taxonomy>
<FolderId>-1</FolderId>
</TaxonomyData>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes" method="xhtml"/>
<xsl:template match="TaxonomyData">
<h1 class="nps_costsavings">
Category: <xsl:value-of select="TaxonomyName"/>
</h1>
<p>
<em>These are the cost savings programs in this category. If you don't see any programs listed here, it means there are none in this category that are available to you.</em>
</p>
<!-- <xsl:copy-of select="."/> -->
<xsl:apply-templates select=".//TaxonomyItems" >
</xsl:apply-templates>
</xsl:template>
<xsl:template match="TaxonomyItems">
<ul class="nps_programs">
<xsl:apply-templates select="TaxonomyItemData" />
</ul>
</xsl:template>
<xsl:template match="TaxonomyItemData">
<li>
<div class="nps_program_summary_top">
</div>
<div class="nps_program_summary">
<table>
<tr>
<td class="nps_program_image_container">
<img class="nps_program_image">
<xsl:attribute name="src">
<xsl:value-of select="TaxonomyItemTeaser/p/img//@src"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:text>Program Logo</xsl:text>
</xsl:attribute>
</img>
</td>
<td class="nps_program_summary">
<h2>
<xsl:value-of select="TaxonomyItemTitle"/>
</h2>
<p>
<!-- omits empty <p> tags and also the <img> tag within <p> tag (from EE) -->
<xsl:apply-templates select="TaxonomyItemTeaser/p[normalize-space(translate(., ' ', ''))]" />
</p>
<a>
<xsl:attribute name="href">
<xsl:value-of select="TaxonomyItemQuickLink"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="TaxonomyItemTitle"/>
</xsl:attribute>
<xsl:text>Learn More</xsl:text>
</a>
</td>
</tr>
</table>
</div>
<div class="nps_program_summary_bot">
</div>
</li>
</xsl:template>
<xsl:template match="TaxonomyItemTeaser/p">
<xsl:copy-of select="." />
</xsl:template>
</xsl:stylesheet>
ASKER
Thank you Gertrone.
I am indeed showing all of the xslt. I don't have control over the XML per se, but I was able to change "HR & Hiring" to "HR and Hiring" to avoid that problem. It did not help me though.
Still I get nothing.
This is part of the Ektron CMS - recall that we had some problems with this before where the XML wasn't "really" XML but was text instead. I fear the same thing is happening here because I am using the same "Ektron server control". With the previous problem, you created strings that we then used instead of the XML tags.
See previous problem here
I am indeed showing all of the xslt. I don't have control over the XML per se, but I was able to change "HR & Hiring" to "HR and Hiring" to avoid that problem. It did not help me though.
Still I get nothing.
This is part of the Ektron CMS - recall that we had some problems with this before where the XML wasn't "really" XML but was text instead. I fear the same thing is happening here because I am using the same "Ektron server control". With the previous problem, you created strings that we then used instead of the XML tags.
See previous problem here
I see, the XSLT declaration states the XSLT version 2.0
I don't know can that be a reason on not, but could you try to change the first two lines from
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes" method="xhtml"/>
to
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes" method="html"/>
and then see if the output changes?
I don't know can that be a reason on not, but could you try to change the first two lines from
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes"
to
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes"
and then see if the output changes?
ASKER
thanks zc2 ...
that does not make any difference.
that does not make any difference.
so, let's use the same thrick as before then.
Can you replace the XSLT with the below one and show us the result you get?
Can you replace the XSLT with the below one and show us the result you get?
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="node()">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
let's go from the suspicion that indeed your <TaxonomyItemTeaser> is a text block instead of a html block
Can you show me the result of this stylesheet?
Can you show me the result of this stylesheet?
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes" method="xhtml"/>
<xsl:template match="TaxonomyData">
<h1 class="nps_costsavings">
Category: <xsl:value-of select="TaxonomyName"/>
</h1>
<p>
<em>These are the cost savings programs in this category. If you don't see any programs listed here, it means there are none in this category that are available to you.</em>
</p>
<!-- <xsl:copy-of select="."/> -->
<xsl:apply-templates select=".//TaxonomyItems" >
</xsl:apply-templates>
</xsl:template>
<xsl:template match="TaxonomyItems">
<ul class="nps_programs">
<xsl:apply-templates select="TaxonomyItemData" />
</ul>
</xsl:template>
<xsl:template match="TaxonomyItemData">
<li>
<div class="nps_program_summary_top">
</div>
<div class="nps_program_summary">
<table>
<tr>
<td class="nps_program_image_container">
<img class="nps_program_image">
<xsl:attribute name="src">
<xsl:value-of select="TaxonomyItemTeaser/p/img//@src"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:text>Program Logo</xsl:text>
</xsl:attribute>
</img>
</td>
<td class="nps_program_summary">
<h2>
<xsl:value-of select="TaxonomyItemTitle"/>
</h2>
<p>
<!-- omits empty <p> tags and also the <img> tag within <p> tag (from EE) -->
<xsl:apply-templates select="TaxonomyItemTeaser" />
</p>
<a>
<xsl:attribute name="href">
<xsl:value-of select="TaxonomyItemQuickLink"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="TaxonomyItemTitle"/>
</xsl:attribute>
<xsl:text>Learn More</xsl:text>
</a>
</td>
</tr>
</table>
</div>
<div class="nps_program_summary_bot">
</div>
</li>
</xsl:template>
<!-- <xsl:template match="TaxonomyItemTeaser">
<xsl:apply-templates select="p[normalize-space(translate(., ' ', ''))]"></xsl:apply-templates>
</xsl:template>
-->
<xsl:template match="TaxonomyItemTeaser">
<xsl:value-of select="translate(., '<>', '[]')"/>
</xsl:template>
</xsl:stylesheet>
And here would be the solution if all were text nodes.
I assumed XSLT1, because Ektron has msxml
I assumed XSLT1, because Ektron has msxml
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes" method="xhtml"/>
<xsl:template match="TaxonomyData">
<h1 class="nps_costsavings">
Category: <xsl:value-of select="TaxonomyName"/>
</h1>
<p>
<em>These are the cost savings programs in this category. If you don't see any programs listed here, it means there are none in this category that are available to you.</em>
</p>
<!-- <xsl:copy-of select="."/> -->
<xsl:apply-templates select=".//TaxonomyItems" >
</xsl:apply-templates>
</xsl:template>
<xsl:template match="TaxonomyItems">
<ul class="nps_programs">
<xsl:apply-templates select="TaxonomyItemData" />
</ul>
</xsl:template>
<xsl:template match="TaxonomyItemData">
<li>
<div class="nps_program_summary_top">
</div>
<div class="nps_program_summary">
<table>
<tr>
<td class="nps_program_image_container">
<img class="nps_program_image">
<xsl:attribute name="src">
<xsl:value-of select="TaxonomyItemTeaser/p/img//@src"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:text>Program Logo</xsl:text>
</xsl:attribute>
</img>
</td>
<td class="nps_program_summary">
<h2>
<xsl:value-of select="TaxonomyItemTitle"/>
</h2>
<!-- omits empty <p> tags and also the <img> tag within <p> tag (from EE) -->
<xsl:apply-templates select="TaxonomyItemTeaser" />
<a>
<xsl:attribute name="href">
<xsl:value-of select="TaxonomyItemQuickLink"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="TaxonomyItemTitle"/>
</xsl:attribute>
<xsl:text>Learn More</xsl:text>
</a>
</td>
</tr>
</table>
</div>
<div class="nps_program_summary_bot">
</div>
</li>
</xsl:template>
<!-- <xsl:template match="TaxonomyItemTeaser">
<xsl:apply-templates select="p[normalize-space(translate(., ' ', ''))]"></xsl:apply-templates>
</xsl:template>
-->
<xsl:template match="TaxonomyItemTeaser">
<xsl:call-template name="process-teaser">
<xsl:with-param name="str" select="."/>
</xsl:call-template>
</xsl:template>
<xsl:template name="process-teaser">
<xsl:param name="str"/>
<xsl:choose>
<xsl:when test="contains($str, '<p>')">
<xsl:variable name="p-content" select="normalize-space(translate(substring-before(substring-after($str, '<p>'), '</p>'),' ', ''))"/>
<xsl:value-of select="substring-before($str, '<p>')"/>
<xsl:choose>
<xsl:when test="$p-content and not(starts-with($p-content, '<img'))">
<p><xsl:value-of select="$p-content" disable-output-escaping="yes"/></p>
</xsl:when>
</xsl:choose>
<xsl:call-template name="process-teaser">
<xsl:with-param name="str" select="substring-after($str, '</p>')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$str"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Gertrone: You have suggested four different variations for the xsl file. I am doing them in order.
The first one:
Displays the XML on the screen. I did a view source and copy/pasted it into an xml file in Visual Studio so it is formatted. That file is attached here.
XMLFile2.xml
The first one:
Displays the XML on the screen. I did a view source and copy/pasted it into an xml file in Visual Studio so it is formatted. That file is attached here.
XMLFile2.xml
ASKER
Here is a screen shot from the second suggestion (I've added a couple more items to the taxonomy since yesterday ...)
Screen-shot-second-suggestion.png
Screen-shot-second-suggestion.png
ASKER
yeah, I could not be stopped :-)
The second one proves it all.... it are indeed txt nodes, not child elements
(good catch, thinking about the Ektron issue again)
So, well that means that the third and fourth stylesheet are on the right track.
You can simply use the fourth one, it will do what you need it to do
The second one proves it all.... it are indeed txt nodes, not child elements
(good catch, thinking about the Ektron issue again)
So, well that means that the third and fourth stylesheet are on the right track.
You can simply use the fourth one, it will do what you need it to do
ASKER
Screen shot from fourth suggestion .... YAY!!!! .... THANK YOU!!!!
Screen-shot-fourth-suggestion.png
Screen-shot-fourth-suggestion.png
welcome
ASKER
Gertone - I cannot thank you enough! Thanks for sticking by me on this one. I just knew it had to be similar to that previous problem.
;-)
;-)
ASKER
Excellent!
ASKER
Oops ...one small problem ...
If there is a space before (or after?) the image tag, the image gets displayed twice ... once with the separate img tag in the xsl, and once as part of the paragraph ... so it's not getting stripped out of the <p> tag. Because of the horrible editor in Ektron, extra spaces get put in all over the place (mostly between consecutive tags) and the user has no control over it.
Do you have a slight "tweak" for this anomaly?
Thanks.
If there is a space before (or after?) the image tag, the image gets displayed twice ... once with the separate img tag in the xsl, and once as part of the paragraph ... so it's not getting stripped out of the <p> tag. Because of the horrible editor in Ektron, extra spaces get put in all over the place (mostly between consecutive tags) and the user has no control over it.
Do you have a slight "tweak" for this anomaly?
Thanks.
<p> <img title="Vendor logo" alt="Vendor logo" src="/uploadedImages/CCA/Content/Forms/Vendor_Logo.png" /> </p>
<p>Lots of great discounts from this vendor</p>
I assumed there was only one img and that it was at the beginning of the p
line 90
<xsl:when test="$p-content and not(starts-with($p-content , '<img'))">
should be
<xsl:when test="$p-content and not(contains($p-content, '<img'))">
it will work
line 90
<xsl:when test="$p-content and not(starts-with($p-content
should be
<xsl:when test="$p-content and not(contains($p-content, '<img'))">
it will work
ASKER
Perfect! Thank you again. ;-)
welcome
Hi Alicia,
Try to stop me!
I figured out that also the   is not a character but an expanded string in the string version of the html,
so my stylesheet would not work if you had a " " in there
(I started looking into it since I was intrigued by the fact that the image stuff did not work)
You need some further recursive processing for getting rid of that character too
Try to stop me!
I figured out that also the   is not a character but an expanded string in the string version of the html,
so my stylesheet would not work if you had a " " in there
(I started looking into it since I was intrigued by the fact that the image stuff did not work)
You need some further recursive processing for getting rid of that character too
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes" method="xhtml"/>
<xsl:template match="TaxonomyData">
<h1 class="nps_costsavings">
Category: <xsl:value-of select="TaxonomyName"/>
</h1>
<p>
<em>These are the cost savings programs in this category. If you don't see any programs listed here, it means there are none in this category that are available to you.</em>
</p>
<!-- <xsl:copy-of select="."/> -->
<xsl:apply-templates select=".//TaxonomyItems" >
</xsl:apply-templates>
</xsl:template>
<xsl:template match="TaxonomyItems">
<ul class="nps_programs">
<xsl:apply-templates select="TaxonomyItemData" />
</ul>
</xsl:template>
<xsl:template match="TaxonomyItemData">
<li>
<div class="nps_program_summary_top">
</div>
<div class="nps_program_summary">
<table>
<tr>
<td class="nps_program_image_container">
<img class="nps_program_image">
<xsl:variable name="image-tag" select="substring-before(substring-after(TaxonomyItemTeaser, '<img'), '>')"/>
<xsl:variable name="src-raw-value" select="substring-after($image-tag, 'src=')"/>
<xsl:variable name="attribute-seperator" select="substring($src-raw-value, 1, 1)"/>
<xsl:variable name="src-attribute" select="substring-before(substring-after($src-raw-value, $attribute-seperator), $attribute-seperator)"/>
<xsl:attribute name="src">
<xsl:value-of select="$src-attribute"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:text>Program Logo</xsl:text>
</xsl:attribute>
</img>
</td>
<td class="nps_program_summary">
<h2>
<xsl:value-of select="TaxonomyItemTitle"/>
</h2>
<!-- omits empty <p> tags and also the <img> tag within <p> tag (from EE) -->
<xsl:apply-templates select="TaxonomyItemTeaser" />
<a>
<xsl:attribute name="href">
<xsl:value-of select="TaxonomyItemQuickLink"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="TaxonomyItemTitle"/>
</xsl:attribute>
<xsl:text>Learn More</xsl:text>
</a>
</td>
</tr>
</table>
</div>
<div class="nps_program_summary_bot">
</div>
</li>
</xsl:template>
<!-- <xsl:template match="TaxonomyItemTeaser">
<xsl:apply-templates select="p[normalize-space(translate(., ' ', ''))]"></xsl:apply-templates>
</xsl:template>
-->
<xsl:template match="TaxonomyItemTeaser">
<xsl:call-template name="process-teaser">
<xsl:with-param name="str" select="."/>
</xsl:call-template>
</xsl:template>
<xsl:template name="process-teaser">
<xsl:param name="str"/>
<xsl:choose>
<xsl:when test="contains($str, '<p>')">
<xsl:variable name="p-content-prep">
<xsl:call-template name="strip-string">
<xsl:with-param name="string-to-strip" select="'&#160;'"/>
<xsl:with-param name="str" select="substring-before(substring-after($str, '<p>'), '</p>')"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="p-content" select="normalize-space($p-content-prep)"/>
<xsl:value-of select="substring-before($str, '<p>')"/>
<xsl:choose>
<xsl:when test="$p-content and not(contains($p-content, '<img'))">
<p><xsl:value-of select="$p-content" disable-output-escaping="yes"/></p>
</xsl:when>
</xsl:choose>
<xsl:call-template name="process-teaser">
<xsl:with-param name="str" select="substring-after($str, '</p>')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$str"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="strip-string">
<xsl:param name="str"/>
<xsl:param name="string-to-strip"/>
<xsl:choose>
<xsl:when test="contains($str, $string-to-strip)">
<xsl:value-of select="substring-before($str, $string-to-strip)"/>
<xsl:call-template name="strip-string">
<xsl:with-param name="string-to-strip" select="$string-to-strip"/>
<xsl:with-param name="str" select="substring-after($str, $string-to-strip)"></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$str"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
ASKER
I would never try to stop you! ;-) You are a big help and I learn alot from you.
The most recent code works just fine, too.
Thank you again!
The most recent code works just fine, too.
Thank you again!
This is what I get.
I am afraid that something happens after the XSLT,
or that you are not showing all of it
Open in new window