How to make xsl show only images/captions from xml - css

I have two images in my xml:
<?xml version="1.0" encoding="UTF-8"?>
<description>
<title>Letter from Waldemar Schultze to Jennie Schultze</title>
<creator type="author">
<name type="personal">Schultze, Waldemar</name>
</creator>
<date>1943-06-30</date>
<source>Special Collections and University Archives, W. E. B. Du Bois Library,
University of Massachusetts Amherst.</source>
<citation>Robert and Waldemar Schultze Papers (MS 528). Special Collections and
University Archives, W.E.B. Du Bois Library, University of
Massachusetts Amherst.</citation>
</description>
<text>
<header type="letterhead">
<imageGroup>
<image xlink:href="mums528-i001-001.png"/>
<caption>page 1</caption>
</imageGroup>
<imageGroup>
<image xlink:href="mums528-i001-002.png"/>
<caption>page 2</caption>
</imageGroup>
<organization>Unites States Disciplinary Barracks</organization>
<location>Fort Leavenworth, Kansas</location>
<date format="M/DD/YY">6/30/43</date>
<recipient>
<name type="personal">Mrs. W.J. Schultze</name>
<address>875 Richmond Av., Buffalo, N.Y.</address>
<relation>Mother</relation>
</recipient>
</header>
<body>
<salutation>Dear Mother,</salutation>
<p><line>This is the first letter I have had</line>
<line>an opportunity to write you since leaving Fort</line>
<line>Jay, and I know you must be anxious to hear from me.</line></p>
<p><line>Bob and I are both feeling as well as</line>
<line>can be expected considering our present cir-</line>
<line>cumstances. We both have high blood</line>
<line>pressure, mine has been 160/100 for the past</line>
<line>2 days, and Bob's 158/96, but my sinus</line>
<line>infection has not caused me quite so much</line>
<line>trouble since leaving N.Y. State. I believe</line>
<line>the air is dryer here and is responsible</line>
<line>for any alleviation that has taken place.</line></p>
<p><line>While a prisoner here remains in their</line>
<line>so-called 1st grade, he is able to write</line>
<line>twice a week, in second grade once a week,</line>
<line>and in third grade once a month. These</line>
<line>grades refer to classifications that ostensibly</line>
<line>are for conduct while here. It is quite possible</line>
<line>to lose a conduct rating, as I understand it,</line>
<line>by not having a perpetually rusting tin cup polished</line>
<pb n="2"/>
<line>brightly for daily inspection, although the tin plating long ago dis-</line>
<line>appeared and the cup is rusty again within 2 hours after wetting.</line></p>
<p><line>The food here is good and is well-cooked,</line>
<line>with one exception, the gravy, which is nothing but</line>
<line>flour, water, and bacon grease, Strangely enough, how-</line>
<line>ever, no condiments, not even salt, are provided on</line>
<line>the table, to the detriment of otherwise very good</line>
<line>meals. While meat here is unrationed and is plentiful,</line>
<line>toilet paper; believe it or not, is rationed. A</line>
<line>5¢ roll must last a prisoner 45 days, or else -- ?</line>
<line>Perhaps, however, a prisoner can purchase additional</line>
<line>if it should be necessary.</line></p>
<p><line>Please see that my subscriptions are transferred</line>
<line>here as soon as possible from Fort Jay. Give Florence</line>
<line>and Helen my regards, and thank Joe for his</line>
<line>efforts in my behalf in managing my business.</line>
<line>Find out from Joe how tube deliveries are at the</line>
<line>present time, first to satisfy my curiosity; and</line>
<line>also let me know if you are receiving your</line>
<line>remittance regularly from him. If he is not</line>
<line>taking care of your support in accordance with</line>
<line>the instructions I left him, I wish to know it,</line>
<line>so I can write, and correct the matter.</line>
<line>You can tell Joe to subscribe to Electronics</line>
<line>magazine for me and send it to this address</line>
<line>direct from the publisher. He should also have a copy</line>
<line>of Palmer's "Calculus for Home Study," sent me by the publisher,</line>
<line>whose name he can obtain from Ulbrichs. In future letters I'll</line>
<line>copy the "Prisoner's Handbook" issued here, and the</line>
<line>contents of the detached letter form stub.</line>
</p>
<valediction>Love, Waldemar</valediction>
</body>
</text>
I want to transform the xml so that ONLY the images and their captions are displayed. Here's my xsl:
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css" href="letter.css"/>
<title>Letter</title>
</head>
<body>
<div>
<xsl:apply-templates/>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="//imageGroup">
<xsl:if test="//imageGroup">
<div class="image">
<xsl:for-each select="//imageGroup">
<img src="{image/#xlink:href}"/>
<span class="caption"><xsl:value-of select="caption"/></span>
</xsl:for-each>
</div>
</xsl:if>
</xsl:template>
The problem is, my output still shows all the text, and my images are doubled. How do I fix it without changing anything in the xml?

Replace the <xsl:apply-templates/> with <xsl:apply-templates select="//imageGroup"/>, then of course your template for those elements should not employ any for-each, but simply display each image, e.g.
<xsl:template match="imageGroup">
<img src="{image/#xlink:href}"/>
<span class="caption"><xsl:value-of select="caption"/></span>
</xsl:template>

Related

Replace text node with element if text match in the document BaseX

I am trying to replace text node with element if document matches that text, below query I have tried but it is giving error "Target is not an element, text, attribute, comment or pi" below is my query.
inputXML:
<book>
<p>Isn't it lovely here? Very smart. We'll be like three queens when you've finished with us,
Edie. You doing well then?</p>
<p>
<name type="person">April De Angelis</name>’ plays include <title type="work">Positive
Hour</title> (Out of Joint) <title type="work">Playhouse Creatures</title> (<name
type="org">Sphinx Theatre Company</name>), <title type="work">Hush</title> (<name
type="org">Royal Court</name>), <title type="work">Soft Vengeance</title>, <title
type="work">The Life and Times of Fanny Hill</title> (adapted from the <name type="org"
>John Cleland novel</name>) and <title type="work">Ironmistress</title>. Her work for
radio includes <title>The Outlander</title> (<name type="org">Radio 5</name>), which won the
<name type="org">Writers’ Guild Award</name> (<date>1992</date>), and, for opera, <title
type="work">Flight</title> with composer <name type="person">Jonathan Dove</name> (<name
type="place">Glyndebourne</name>, <date>1998</date>).</p>
</book>
Expected output:
<book>
<p>Isn't it lovely here? Very smart. We'll be like three <highlight>>queens</highlight> when
you've finished with us, Edie. You doing well then?</p>
<p>
<name type="person">April De Angelis</name>’ plays <highlight>include</highlight>
<title type="work">Positive Hour</title> (Out of Joint) <title type="work">Playhouse
Creatures</title> (<name type="org">Sphinx Theatre Company</name>), <title type="work"
>Hush</title> (<name type="org">Royal Court</name>), <title type="work">Soft
Vengeance</title>, <title type="work">The Life and Times of Fanny Hill</title> (adapted
from the <name type="org">John Cleland novel</name>) and <title type="work"
>Ironmistress</title>. Her work for radio includes <title>The Outlander</title> (<name
type="org">Radio 5</name>), which won the <name type="org">Writers’ Guild Award</name>
(<date>1992</date>), and, for opera, <title type="work">Flight</title> with composer
<name type="person">Jonathan Dove</name> (<name type="place">Glyndebourne</name>,
<date>1998</date>).</p>
</book>
I am using BaseX version 9.5.1 below is the code.
let $body := <indexedterms>
<content>
<terms>
<term>include</term>
<term>Queens</term>
</terms>
<uri>/IEEE/IEEE/test.xml</uri>
</content>
</indexedterms>
for $contents in $body/content
let $uri := $contents/uri
let $doc := fn:doc($uri)
for $selectedterm in $contents/terms/term/string()
let $Modifieddoc := copy $c := $doc
modify
(
for $nodes in $c//*//text()[fn:matches(.,$selectedterm)]/parent::*
return
if($nodes/node()[fn:matches(.,$selectedterm)]/parent::*:highlight)
then ()
else
replace node $nodes/$selectedterm with <highlight>{$selectedterm}</highlight>
)
return $c
return
db:replace('IEEE',substring-after($uri,'/IEEE'),$Modifieddoc)
Previously I was using the "replace node $nodes/node()[fn:contains(.,$selectedterm)] with {$selectedterm} " instead of "replace node $nodes/$selectedterm with {$selectedterm}" it was doing the work but where terms like steam e.g.(include, includes) so it was matching the both words which is not correct so I have changed the code to "replace node "$nodes/$selectedterm with {$selectedterm}"
$nodes/$selectedterm is probably the culprit and most likely not what you want as the $selectedterm variable is a sequence of string values (you bind for $selectedterm in $contents/terms/term/string()). It might help us understand what you want to achieve if you show us a sample document you load with the doc function and the update you want to do on that with BaseX, for instance, for the two sample terms you have shown in your code snippet.
Your task of identifying and wrapping search terms in your text contents can be done nicely in XSLT 3 or 3 which you can run with BaseX if you put Saxon 9.9 or 10 or 11 on the class path:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="3.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
exclude-result-prefixes="#all"
expand-text="yes">
<xsl:param name="terms" as="xs:string*" select="'include', 'Queens'"/>
<xsl:output method="xml" indent="no"/>
<xsl:template match="p//text()">
<xsl:apply-templates select="analyze-string(., string-join($terms, '|'), 'i')/node()"/>
</xsl:template>
<xsl:template match="fn:match">
<highlight>{.}</highlight>
</xsl:template>
<xsl:template match="fn:non-match">
<xsl:apply-templates/>
</xsl:template>
<xsl:mode on-no-match="shallow-copy"/>
</xsl:stylesheet>
As the used analyze-string function exists also in BaseX/XQuery you should also be able to use XQuery update on the result calling that function, i.e. by replacing fn:match elements with highlight elements.

XML -> list -> Data Frame in R with variable structure

This is my first post to Stack so please let me know if I haven't posted enough information. I have however, looked through many of the other answered questions and tried many of those solutions which as a result have ended me here.
I am having trouble getting the data out of a series of around 800 xml files. I would like the following data frame.
Model Species PubChemID out of "rdf:li*
Abiotrophia_defectiva_ATCC_49176 M_10fthf__91__c__93__ 122347
Abiotrophia_defectiva_ATCC_49176 M_10m3hddcaACP__91__c__93__ N/A
I can clean the rest of the URL out after its in a data frame for the PubChemID
From the following xml example.
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:fbc="http://www.sbml.org/sbml/level3/version1/fbc/version2" xmlns:groups="http://www.sbml.org/sbml/level3/version1/groups/version1" level="3" version="1" fbc:required="false" groups:required="false">
<model metaid="Abiotrophia_defectiva_ATCC_49176" id="Abiotrophia_defectiva_ATCC_49176" name="Abiotrophia defectiva ATCC 49176" fbc:strict="true">
<notes>
<body xmlns="http://www.w3.org/1999/xhtml">
<div>
<h1>Abiotrophia_defectiva_ATCC_49176</h1>
<h2>Description</h2>
<p>This is a metabolism reconstruction of Abiotrophia defectiva ATCC 49176</p>1.03<p>Authors: Stefania Magnusdottir, Almut Heinken, Laura Kutt, Dmitry A. Ravcheev, Eugen Bauer, Alberto Noronha, Kacy Greenhalgh, Christian Jaeger, Joanna Baginska, Paul Wilmes, Ronan M.T. Fleming, and Ines Thiele.</p>
<h3>Draft information</h3>
<p>
<ul>
<li> PubSEED ID: Abiotrophia defectiva ATCC 49176 (592010.4)</li>
<li> Draft reconstruction ID: Seed592010_4_124632</li>
<li> Draft platform: ModelSEED</li>
<li> Draft created: 7/1/2014</li>
</ul>
</p>
<p>This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.</p>
<p>When using this model in your research works, please cite: Magnusdottir et al., Generation of genome-scale metabolic reconstructions for 773 members of the human gut microbiota, Nat Biotechnol, 2016.</p></div>
</body>
</notes>
<annotation>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:vCard4="http://www.w3.org/2006/vcard/ns#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#Abiotrophia_defectiva_ATCC_49176">
<bqbiol:is>
<rdf:Bag>
<rdf:li rdf:resource="http://identifiers.org/taxonomy/592010"/>
</rdf:Bag>
</bqbiol:is>
</rdf:Description>
</rdf:RDF>
</annotation>
<listOfUnitDefinitions>
<unitDefinition id="mmol_per_gDW_per_hr">
<listOfUnits>
<unit kind="mole" exponent="1" scale="-3" multiplier="1"/>
<unit kind="gram" exponent="-1" scale="0" multiplier="1"/>
<unit kind="second" exponent="-1" scale="0" multiplier="3600"/>
</listOfUnits>
</unitDefinition>
</listOfUnitDefinitions>
<listOfCompartments>
<compartment metaid="c" id="c" name="Cytoplasm" constant="false"/>
<compartment metaid="e" id="e" name="Extracellular" constant="false"/>
</listOfCompartments>
<listOfSpecies>
<species metaid="M_10fthf__91__c__93__" id="M_10fthf__91__c__93__" name="10-Formyltetrahydrofolate" compartment="c" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false" fbc:charge="-2" fbc:chemicalFormula="C20H21N7O7">
<annotation xmlns:sbml="http://www.sbml.org/sbml/level3/version1/core">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:vCard4="http://www.w3.org/2006/vcard/ns#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#M_10fthf__91__c__93__">
<bqbiol:is>
<rdf:Bag>
<rdf:li rdf:resource="http://identifiers.org/hmdb/HMDB00972"/>
<rdf:li rdf:resource="http://identifiers.org/kegg.compound/C00234"/>
<rdf:li rdf:resource="http://identifiers.org/pubchem.compound/122347"/>
</rdf:Bag>
</bqbiol:is>
</rdf:Description>
</rdf:RDF>
</annotation>
</species>
<species metaid="M_10m3hddcaACP__91__c__93__" id="M_10m3hddcaACP__91__c__93__" name="10-methyl-3-hydroxy-dodecanoyl-ACP" compartment="c" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false" fbc:charge="-1" fbc:chemicalFormula="C24H45N2O9PRS"/>
<species metaid="M_10m3hundecACP__91__c__93__" id="M_10m3hundecACP__91__c__93__" name="10-methyl-3-hydroxy-undecanoyl-ACP" compartment="c" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false" fbc:charge="-1" fbc:chemicalFormula="C23H43N2O9PRS"/>
<species metaid="M_10m3oddcaACP__91__c__93__" id="M_10m3oddcaACP__91__c__93__" name="10-methyl-3-oxo-dodecanoyl-ACP" compartment="c" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false" fbc:charge="-1" fbc:chemicalFormula="C24H43N2O9PRS"/>
</listOfSpecies>
</model>
</sbml>
I have been successful in converting to a list in r and calling the first element that should apply to the other 800 xml
library(xml2)
list <- xmlToList("StackExample.xml")
list[["model"]][["notes"]][["body"]][["div"]][["h1"]]
I also can get all of the species out but the fact that some of the nodes contain more hierarchy has got me a bit baffled.
species.list <- list$model$listOfSpecies
specieslist <- lapply(species.list, '[[', 1)
How does one add an if/else type function into "lapply" so that it looks for "/rdf:resources" in the additional hierarchy?
Lastly, I am pretty sure that applying whatever script to the remainder of the files should be doable.
Thanks

How to output an IMG tag from XML using XSLT

Here is my XML:
<?xml version="1.0" encoding="UTF-8"?>
<Collection>
<Content>
<ID>2779</ID>
<Type>Content</Type>
<Title>Article One</Title>
<QuickLink>/template.aspx?id=2779</QuickLink>
<Teaser />
<Html>
<root>
<NewsArticle>
<artTitle>The Comprehensive Breast Center: Quality Care on the Fast Track</artTitle>
<artThumb>
<img alt="Thumb Article One" src="/uploadedImages/Test/News/artOne.png?n=5954" />
</artThumb>
<artFull />
<releaseDate />
<contactName />
<contactPhone />
<contactEmail />
<artTeaser>The National Cancer Institute estimates that a woman in the United States has a 1 in 8 chance of developing invasive breast cancer</artTeaser>
<artText>
<p>The Comprehensive Breast Center: Quality Care on
the Fast Track</p>
<p>
How do I display the IMG tag from my XML above to an HTML document using XSLT
Something like this should do the trick:
<xsl:template match="/">
<xsl:for-each select="Collection/Content">
<xsl:copy-of select="Html/root/NewsArticle/artThumb/node()"/>
</xsl:for-each>
</xsl:template>
I should note that this assumes you're getting this from an Ektron collection -- assumption made based on your tagging of this question. This will display the image from each content block in the collection. If you want just the image from the first content block of the collection, you could remove the for-each and instead use something like this:
<xsl:template match="/">
<xsl:copy-of select="Collection/Content/Html/root/NewsArticle/artThumb/node()"/>
</xsl:template>
Also, it works either way, but i removed the slash from the front of the select on the for-each. Seemed redundant since the code is in a template that already matches on "/".
UPDATE
Some of that can be done in the workarea -- it allows you to set the css class, though I'm not sure if you can set the title attribute of an image. Here's how you could do that via XSLT. In this case, you can't copy the node whole-sale:
<xsl:template match="/">
<xsl:for-each select="Collection/Content">
<xsl:variable name="imageSrc" select="Html/root/NewsArticle/artThumb/img/#src" />
<xsl:variable name="imageId">
<xsl:text>NewsArticle_</xsl:text>
<xsl:value-of select="ID" />
<xsl:text>_image</xsl:text>
</xsl:variable>
<xsl:variable name="contentTitle" select="Html/root/NewsArticle/artTitle" />
<img id="{ $imageId }" class="myCssClass" title="{ $contentTitle }" alt="{ $contentTitle }" src="{ $imageSrc }" />
</xsl:for-each>
</xsl:template>
(Updated again - appears i misread your comment. Thanks, #MathiasMüller!)
When assigning ids to elements like this, I prefer to use a little more than just the content id. In this case, by using "NewsArticle_{Content ID}image", I allow for a container div to use an id "NewsArticle{Content Id}" if it is needed in the future without colliding with the image ids.
How do i assign a title and an alt from artTitle and also a class and id?
Building upon the answer given by #BrianOliver, this is how you output an img element whose "title" attribute reflects the content of artTitle from your input XML - the same for ID.
I assume that by "an alt from artTitle" you mean that the text content of img/#alt should also come from the artTitle element.
<xsl:template match="/">
<xsl:for-each select="Collection/Content">
<xsl:variable name="imageSrc" select="Html/root/NewsArticle/artThumb/img/#src" />
<!--xsl:variable name="imageAlt" select="Html/root/NewsArticle/artThumb/img/#alt" /-->
<xsl:variable name="imageId" select="ID"/>
<xsl:variable name="imageTitle" select="Html/root/NewsArticle/artTitle"/>
<img id="{$imageId}" class="myCssClass" title="{$imageTitle}" alt="{ $imageTitle}" src="{$imageSrc}"/>
</xsl:for-each>
</xsl:template>
However, I am not sure where the class attribute should come from.

Strange Content and Deleted page is still viewable in Umbraco

I am running umbraco v 4.0.3. My web server is Windows Server 2003.
I noticed that one of my pages was being displayed with content from a parent node in addition to the of the control it hosted. Since the page only serves as a host for an ascx control, it has no content of its own.
The content area of the node is empty, so I am at a loss of where this content is coming from.
I have done the following things to attempt to resolve the problem, but none of them resulted in the page in question changing at all. The page persists.
I've published the node again.
I've clicked the unpublish button, and then published the node.
I've cleared my browsers cache.
I've used multiple browsers.
I've used the incognito mode on Chrome.
I've changed the template the node is based on, which should have prevented the macro from running, but it didn't.
I've added content to the node. The new content didn't show up.
I've changed the node's name. When I reload the page under it's old name, it's still there.
I've touched web.config to restart the application. There was no change.
I've stopped and started the website.
I've right clicked on the top node of the site, and choose "republish"
I've manually deleted the umbraco.conf file under the data folder.
I've even deleted the node.
Nothing I do changes what appears when I navigate to the page. At this point, I should get a 404, but the page still loads and still runs the macro.
At this point, I am at a loss of what to do, but I'm guessing it has something to do with IIS or Dot.Net and caching.
Does anybody have an idea how to fix this?
EDIT
I have found that if I removed an XSLT macro reference from the template upon which the deleted page was built, the duplication of the parent page goes away when the deleted page loads in the browser. Since this was my primary problem, I've recreated the page and have gone on. I am still perplexed as to why the page I deleted was able to be loaded from multiple browsers.
The macro I removed is used in the majority of the 1,500+ pages of our web site, and on none of them does it reproduce the parent's document on the child, nor does it seem possible to me that an XSLT macro can reach outside of the XML cache. I've reviewed the code, and didn't see any references to an additional data store. I confess that XSLT is quite new to me.
The code for the macro whose reference I removed is listed below.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
xmlns:custom="urn:custom.library"
exclude-result-prefixes="msxml umbraco.library custom">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<msxml:script language="C#" implements-prefix="custom">
public System.Xml.XPath.XPathNodeIterator SplitMultiPageText(string unsplitText,
string pageDelimeter) {
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
string[] splitPages = System.Text.RegularExpressions.Regex.Split(unsplitText, pageDelimeter);
System.Xml.XmlElement pagesElement = xmlDoc.CreateElement("pages");
foreach (string page in splitPages) {
System.Xml.XmlElement pageElement = xmlDoc.CreateElement("page");
pageElement.AppendChild(xmlDoc.CreateCDataSection(page));
pagesElement.AppendChild(pageElement);
}
return pagesElement.CreateNavigator().Select(".");
}
</msxml:script>
<xsl:param name="currentPage"/>
<xsl:variable name="content" select="/macro/content" />
<xsl:variable name="pageNumber" select="/macro/pageNumber" />
<xsl:variable name="joinContent">
<xsl:choose>
<xsl:when test="/macro/joinContent = ''">
<xsl:value-of select="boolean(false)" />
</xsl:when>
<xsl:otherwise><xsl:value-of select="/macro/joinContent" /></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="splitExpr"><hr class="pagebreak" /></xsl:variable>
<xsl:template match="/">
<xsl:variable name="pages" select="custom:SplitMultiPageText($content, $splitExpr)" />
<xsl:variable name="pageCount" select="count($pages/page)" />
<xsl:choose>
<xsl:when test="$pageCount = 1 or string($joinContent) = 'true'">
<xsl:for-each select="$pages/page">
<xsl:value-of
select="umbraco.library:RenderMacroContent(., $currentPage/#id)"
disable-output-escaping="yes" />
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<p class="multiPageNotice">This document is split among multiple pages. To view
the other pages, use the <strong>page selector</strong> near the bottom of the screen.</p>
<xsl:for-each select="$pages/page">
<xsl:if test="position() = $pageNumber or ( $pageNumber = '' and position() = 1 )">
<xsl:value-of
select="umbraco.library:RenderMacroContent(., $currentPage/#id)"
disable-output-escaping="yes" />
</xsl:if>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$pageCount > 1 and string($joinContent) != 'true'">
<div class="pageSelector">
<p>Page: </p>
<ul>
<xsl:for-each select="$pages/page">
<li>
<xsl:choose>
<xsl:when test="position() = $pageNumber or ( $pageNumber = '' and position() = 1 )">
<xsl:value-of select="position()" />
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl($currentPage/#id)}/page/{position()}">
<xsl:value-of select="position()" />
</a>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Given your comment, it's possible that the macro persists content to a store that is independent of the application/umbraco config, e.g. an xml file or a db-based session. This would obviously persist the data outside of the application restarting. Obviously, we would have to see the code for the macro though.

In feeds, can multiple <content:encoded> elements exist inside an <item>?

Precisely... can multiple <content:encoded> elements exist inside an <item> in a valid feed?
Full Story: I am modding the markup of my blog's RSS feeds for Google Currents, and for the app to display image galleries in articles as slideshows, the markup of my feed should look like this:
<rss version="2.0" ... xmlns:media="http://search.yahoo.com/mrss/">
...
<item>
<title>Item One</title>
<link>http://example.com/news/item-one</link>
<description>
<p>This is an example feed item</p>
</description>
...
<pubDate>Thu, 04 Aug 2011 19:41:00 GMT</pubDate>
<guid>http://example.com/news/item-one</guid>
<media:content height="84" type="image/jpeg" width="140" url="http://static.example.com/photo1.jpg">
<media:description>Caption for Photo 1</media:description>
</media:content>
<media:content height="100" type="image/jpeg" width="200" url="http://static.example.com/photo2.jpg">
<media:description>Caption for Photo 2</media:description>
</media:content>
<content:encoded><![CDATA[
<p>All the content goes here.</p>
<p>This is another line.</p>
]]></content:encoded>
...
</item>
...
</rss>
But due to the way my WordPress blog works, the galleries are shown within the article (which is usual), which means, the same happens in the RSS feeds as well. But the <media:content> element cannot be a sub-element of <content:encoded>.
So, I am wondering if I can do it like this and it'd still be valid RSS feed:
<rss version="2.0" ... xmlns:media="http://search.yahoo.com/mrss/">
...
<item>
<title>Item One</title>
<link>http://example.com/news/item-one</link>
<description>
<p>This is an example feed item</p>
</description>
...
<pubDate>Thu, 04 Aug 2011 19:41:00 GMT</pubDate>
<guid>http://example.com/news/item-one</guid>
<content:encoded><![CDATA[
<p>All the content goes here.</p>
]]></content:encoded>
<media:content height="84" type="image/jpeg" width="140" url="http://static.example.com/photo1.jpg">
<media:description>Caption for Photo 1</media:description>
</media:content>
<media:content height="100" type="image/jpeg" width="200" url="http://static.example.com/photo2.jpg">
<media:description>Caption for Photo 2</media:description>
</media:content>
<content:encoded><![CDATA[
<p>This is another line.</p>
]]></content:encoded>
...
</item>
...
</rss>
As you can see, I'd basically be splitting the <content:encoded> element into two, to give way for the slideshow markup. So, there'll be two <content:encoded> elements inside an <item>. Is that okay?
Having run my feed through W3C's Feed Validation Service, the answer seems to be "YES", multiple <content:encoded> elements can exist inside an <item> in a feed.

Resources