Last change
on this file since 33126 was 31905, checked in by kjdon, 7 years ago |
handle case where rss has an error: just print it out. Would be nicer to make teh page look like teh about page or something, but this will do for now.
|
File size:
1.6 KB
|
Rev | Line | |
---|
[27087] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
| 2 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xsl">
|
---|
| 3 | <!-- exclude-result-prefixes="#default">-->
|
---|
| 4 |
|
---|
[27088] | 5 | <!-- Adding the xml processing instruction, see http://www.xml.com/lpt/a/1027 -->
|
---|
[27087] | 6 | <xsl:output method="xml" version="1.0" encoding="utf-8"/>
|
---|
| 7 |
|
---|
| 8 |
|
---|
| 9 | <!-- select only the rss child of /page/pageResponse and then copy all its attributes and
|
---|
| 10 | descendant elements and their attributes too into the output
|
---|
| 11 | http://stackoverflow.com/questions/1141216/xsl-copy-the-entire-xml-except-a-parent-node-but-keep-its-child-node
|
---|
| 12 | http://stackoverflow.com/questions/5378610/copy-xml-document-with-all-elements-except-a-black-list-of-elements
|
---|
| 13 | http://stackoverflow.com/questions/5876382/using-xslt-to-copy-all-nodes-in-xml
|
---|
| 14 |
|
---|
| 15 | To do a straightforward copy of input into output:
|
---|
| 16 | <xsl:template match="/">
|
---|
| 17 | <xsl:copy-of select="." />
|
---|
| 18 | </xsl:template>
|
---|
| 19 | -->
|
---|
| 20 |
|
---|
[31905] | 21 | <xsl:template match="/page">
|
---|
| 22 | <xsl:choose>
|
---|
| 23 | <xsl:when test="pageResponse/rss">
|
---|
| 24 | <xsl:apply-templates select="pageResponse/rss"/>
|
---|
| 25 | </xsl:when>
|
---|
| 26 | <xsl:when test="descendant::error">
|
---|
| 27 | <div id="error">
|
---|
| 28 | <xsl:apply-templates select="descendant::error"/>
|
---|
| 29 | </div>
|
---|
| 30 | </xsl:when>
|
---|
| 31 | <xsl:otherwise><!-- do what?-->
|
---|
| 32 | </xsl:otherwise>
|
---|
| 33 | </xsl:choose>
|
---|
[27087] | 34 | </xsl:template>
|
---|
| 35 |
|
---|
| 36 | <!--Identity template, copies all content of matching template(s) into the output -->
|
---|
| 37 | <xsl:template match="@* | node()">
|
---|
| 38 | <xsl:copy>
|
---|
| 39 | <xsl:apply-templates select="@* | node()"/>
|
---|
| 40 | </xsl:copy>
|
---|
| 41 | </xsl:template>
|
---|
| 42 |
|
---|
| 43 | </xsl:stylesheet>
|
---|
| 44 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.