You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by rg...@apache.org on 2006/11/18 01:12:06 UTC
svn commit: r476384 [3/3] - in /forrest/trunk/whiteboard/forrest2: ./
.settings/ core/ core/org/ core/org/apache/ core/org/apache/forrest/
core/org/apache/forrest/cli/ core/org/apache/forrest/core/
core/org/apache/forrest/core/document/ core/org/apache...
Added: forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/xdocs/exampleFeed.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/xdocs/exampleFeed.xml?view=auto&rev=476384
==============================================================================
--- forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/xdocs/exampleFeed.xml (added)
+++ forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/xdocs/exampleFeed.xml Fri Nov 17 16:12:01 2006
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<products>
+ <product>
+ <TDProductId>32350009</TDProductId>
+ <name>Seven London Sterling Silver Cross and Chain</name>
+ <description>"Trendy, stylish and great quality, the fashion-conscious man in your life will love this sterling silver cross pendant and chain from Seven London"</description>
+ <imageUrl>http://www.johnlewis.com/jl_assets/product/230221377.jpg</imageUrl>
+ <productUrl>http://pdt.tradedoubler.com/click?a(1290335)p(1231)prod(32350009)</productUrl>
+ <price>45.0</price>
+ <currency>GBP</currency>
+ <TDCategories>
+ <TDCategory>
+ <id>1480</id>
+ <name>Valentines</name>
+ <merchantName>PRODUCTS_WITHOUT_CATEGORIES</merchantName>
+ </TDCategory>
+ </TDCategories>
+ <fields/>
+ </product>
+ <product>
+ <TDProductId>32350011</TDProductId>
+ <name>Sterling Silver Heart Keyring</name>
+ <description>The key to your heart? This hallmarked sterling silver heart keyring makes an intimate gift. </description>
+ <imageUrl>http://www.johnlewis.com/jl_assets/product/230225943.jpg</imageUrl>
+ <productUrl>http://pdt.tradedoubler.com/click?a(1290335)p(1231)prod(32350011)</productUrl>
+ <price>25.0</price>
+ <currency>GBP</currency>
+ <TDCategories>
+ <TDCategory>
+ <id>1480</id>
+ <name>Valentines</name>
+ <merchantName>PRODUCTS_WITHOUT_CATEGORIES</merchantName>
+ </TDCategory>
+ </TDCategories>
+ <fields/>
+ </product>
+ <product>
+ <TDProductId>32350013</TDProductId>
+ <name>"Heart Ring Holder, by Waterford Crystal"</name>
+ <description>Heart ring holder made of full lead crystal. Hand crafted in Ireland by Waterford Crystal. </description>
+ <imageUrl>http://www.johnlewis.com/jl_assets/product/230148641.jpg</imageUrl>
+ <productUrl>http://pdt.tradedoubler.com/click?a(1290335)p(1231)prod(32350013)</productUrl>
+ <price>22.0</price>
+ <currency>GBP</currency>
+ <TDCategories>
+ <TDCategory>
+ <id>1480</id>
+ <name>Valentines</name>
+ <merchantName>PRODUCTS_WITHOUT_CATEGORIES</merchantName>
+ </TDCategory>
+ </TDCategories>
+ <fields/>
+ </product>
+ <product>
+ <TDProductId>32350015</TDProductId>
+ <name>"Philosophy Falling In Love Fragrance, 59.2ml"</name>
+ <description>"A sexy, sensual fragrance described by Philosophy as 'a creative blend of sweet, delectable vanilla"</description>
+ <imageUrl>http://www.johnlewis.com/jl_assets/product/230213127.jpg</imageUrl>
+ <productUrl>http://pdt.tradedoubler.com/click?a(1290335)p(1231)prod(32350015)</productUrl>
+ <price>32.0</price>
+ <currency>GBP</currency>
+ <TDCategories>
+ <TDCategory>
+ <id>1480</id>
+ <name>Valentines</name>
+ <merchantName>PRODUCTS_WITHOUT_CATEGORIES</merchantName>
+ </TDCategory>
+ </TDCategories>
+ <fields/>
+ </product>
+ <product>
+ <TDProductId>32350017</TDProductId>
+ <name>"Michael Kors ""For Men"" Gift Set"</name>
+ <description>"""Michael Kors For Men"" is a sophisticated fragrance with notes of patchouli, suede, smoke and spices"</description>
+ <imageUrl>http://www.johnlewis.com/jl_assets/product/230220651.jpg</imageUrl>
+ <productUrl>http://pdt.tradedoubler.com/click?a(1290335)p(1231)prod(32350017)</productUrl>
+ <price>40.0</price>
+ <currency>GBP</currency>
+ <TDCategories>
+ <TDCategory>
+ <id>1480</id>
+ <name>Valentines</name>
+ <merchantName>PRODUCTS_WITHOUT_CATEGORIES</merchantName>
+ </TDCategory>
+ </TDCategories>
+ <fields/>
+ </product>
+ <product>
+ <TDProductId>32350019</TDProductId>
+ <name>"Chocolates By Post, 320g"</name>
+ <description>Hereââ¬â¢s a package theyââ¬â¢ll definitely look forward to receiving in the post</description>
+ <imageUrl>http://www.johnlewis.com/jl_assets/product/230221984.jpg</imageUrl>
+ <productUrl>http://pdt.tradedoubler.com/click?a(1290335)p(1231)prod(32350019)</productUrl>
+ <price>13.0</price>
+ <currency>GBP</currency>
+ <TDCategories>
+ <TDCategory>
+ <id>1480</id>
+ <name>Valentines</name>
+ <merchantName>PRODUCTS_WITHOUT_CATEGORIES</merchantName>
+ </TDCategory>
+ </TDCategories>
+ <fields/>
+ </product>
+ <product>
+ <TDProductId>32350021</TDProductId>
+ <name>"Balmain Stripe Tie and Handkerchief Set, Aqua"</name>
+ <description>He'll look perfectly co-ordinated with this silk tie and handkerchief from Balmain</description>
+ <imageUrl>http://www.johnlewis.com/jl_assets/product/230220187.jpg</imageUrl>
+ <productUrl>http://pdt.tradedoubler.com/click?a(1290335)p(1231)prod(32350021)</productUrl>
+ <price>25.0</price>
+ <currency>GBP</currency>
+ <TDCategories>
+ <TDCategory>
+ <id>1480</id>
+ <name>Valentines</name>
+ <merchantName>PRODUCTS_WITHOUT_CATEGORIES</merchantName>
+ </TDCategory>
+ </TDCategories>
+ <fields/>
+ </product>
+ <product>
+ <TDProductId>32350023</TDProductId>
+ <name>"Radley Dog in Pocket Mini Shoulder Bag, Berry"</name>
+ <description>Soft leather shoulder bag from Radley with a main zipped fastening</description>
+ <imageUrl>http://www.johnlewis.com/jl_assets/product/230220003.jpg</imageUrl>
+ <productUrl>http://pdt.tradedoubler.com/click?a(1290335)p(1231)prod(32350023)</productUrl>
+ <price>55.0</price>
+ <currency>GBP</currency>
+ <TDCategories>
+ <TDCategory>
+ <id>1480</id>
+ <name>Valentines</name>
+ <merchantName>PRODUCTS_WITHOUT_CATEGORIES</merchantName>
+ </TDCategory>
+ </TDCategories>
+ <fields/>
+ </product>
+ <product>
+ <TDProductId>32350025</TDProductId>
+ <name>"Pashmina Shawl, Baby Pink"</name>
+ <description>"Beautifully soft, full size Pashmina with classic plain weave and fringe."</description>
+ <imageUrl>http://www.johnlewis.com/jl_assets/product/230162999.jpg</imageUrl>
+ <productUrl>http://pdt.tradedoubler.com/click?a(1290335)p(1231)prod(32350025)</productUrl>
+ <price>75.0</price>
+ <currency>GBP</currency>
+ <TDCategories>
+ <TDCategory>
+ <id>1480</id>
+ <name>Valentines</name>
+ <merchantName>PRODUCTS_WITHOUT_CATEGORIES</merchantName>
+ </TDCategory>
+ </TDCategories>
+ <fields/>
+ </product>
+ <product>
+ <TDProductId>32350027</TDProductId>
+ <name>Hudson Champagne Cocktail Set</name>
+ <description>"Live the high life with this handmade stainless steel and glass cocktail shaker, 2 handmade champagne glasses and 2 glass coasters"</description>
+ <imageUrl>http://www.johnlewis.com/jl_assets/product/230221019.jpg</imageUrl>
+ <productUrl>http://pdt.tradedoubler.com/click?a(1290335)p(1231)prod(32350027)</productUrl>
+ <price>15.0</price>
+ <currency>GBP</currency>
+ <TDCategories>
+ <TDCategory>
+ <id>1480</id>
+ <name>Valentines</name>
+ <merchantName>PRODUCTS_WITHOUT_CATEGORIES</merchantName>
+ </TDCategory>
+ </TDCategories>
+ <fields/>
+ </product>
+ <product>
+ <TDProductId>32350029</TDProductId>
+ <name>Brut Champagne and Rosé</name>
+ <description>200ml bottles of Nicolas Feuillaté brut champagne and sparkling rosé. Each comes in a plastic box</description>
+ <imageUrl>http://www.johnlewis.com/jl_assets/product/230221709.jpg</imageUrl>
+ <productUrl>http://pdt.tradedoubler.com/click?a(1290335)p(1231)prod(32350029)</productUrl>
+ <price>16.0</price>
+ <currency>GBP</currency>
+ <TDCategories>
+ <TDCategory>
+ <id>1480</id>
+ <name>Valentines</name>
+ <merchantName>PRODUCTS_WITHOUT_CATEGORIES</merchantName>
+ </TDCategory>
+ </TDCategories>
+ <fields/>
+ </product>
+ <product>
+ <TDProductId>32350031</TDProductId>
+ <name>Brut Champagne and Chocolates</name>
+ <description>"A delectable duo of Belgian chocolates and a full bottle of champagne, made exclusively for John Lewis"</description>
+ <imageUrl>http://www.johnlewis.com/jl_assets/product/230220651.jpg</imageUrl>
+ <productUrl>http://pdt.tradedoubler.com/click?a(1290335)p(1231)prod(32350031)</productUrl>
+ <price>30.0</price>
+ <currency>GBP</currency>
+ <TDCategories>
+ <TDCategory>
+ <id>1480</id>
+ <name>Valentines</name>
+ <merchantName>PRODUCTS_WITHOUT_CATEGORIES</merchantName>
+ </TDCategory>
+ </TDCategories>
+ <fields/>
+ </product>
+ <product>
+ <TDProductId>32350033</TDProductId>
+ <name>Rose & Lily Super Bouquet</name>
+ <description>"The same beautiful mix as our standard bouquet, but with 33% more blooms for just 5 extra"</description>
+ <imageUrl>http://www.johnlewis.com/jl_assets/product/230220427.jpg</imageUrl>
+ <productUrl>http://pdt.tradedoubler.com/click?a(1290335)p(1231)prod(32350033)</productUrl>
+ <price>40.0</price>
+ <currency>GBP</currency>
+ <TDCategories>
+ <TDCategory>
+ <id>1480</id>
+ <name>Valentines</name>
+ <merchantName>PRODUCTS_WITHOUT_CATEGORIES</merchantName>
+ </TDCategory>
+ </TDCategories>
+ <fields/>
+ </product>
+ <product>
+ <TDProductId>32350035</TDProductId>
+ <name>Heaven Scent Arrangement</name>
+ <description>We've updated this hugely popular arrangement that we first introduced last spring</description>
+ <imageUrl>http://www.johnlewis.com/jl_assets/product/230229130.jpg</imageUrl>
+ <productUrl>http://pdt.tradedoubler.com/click?a(1290335)p(1231)prod(32350035)</productUrl>
+ <price>35.0</price>
+ <currency>GBP</currency>
+ <TDCategories>
+ <TDCategory>
+ <id>1480</id>
+ <name>Valentines</name>
+ <merchantName>PRODUCTS_WITHOUT_CATEGORIES</merchantName>
+ </TDCategory>
+ </TDCategories>
+ <fields/>
+ </product>
+ <product>
+ <TDProductId>32350037</TDProductId>
+ <name>Sweet Unique Bouquet</name>
+ <description>A great value bouquet in bold colours</description>
+ <imageUrl>http://www.johnlewis.com/jl_assets/product/230229120.jpg</imageUrl>
+ <productUrl>http://pdt.tradedoubler.com/click?a(1290335)p(1231)prod(32350037)</productUrl>
+ <price>25.0</price>
+ <currency>GBP</currency>
+ <TDCategories>
+ <TDCategory>
+ <id>1480</id>
+ <name>Valentines</name>
+ <merchantName>PRODUCTS_WITHOUT_CATEGORIES</merchantName>
+ </TDCategory>
+ </TDCategories>
+ <fields/>
+ </product>
+</products>
Propchange: forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/xdocs/exampleFeed.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/xslt/tradeDoublerFeed-to-internal.xsl
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/xslt/tradeDoublerFeed-to-internal.xsl?view=auto&rev=476384
==============================================================================
--- forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/xslt/tradeDoublerFeed-to-internal.xsl (added)
+++ forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/xslt/tradeDoublerFeed-to-internal.xsl Fri Nov 17 16:12:01 2006
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/2002/06/xhtml2"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:html="http://www.w3.org/2002/06/xhtml2">
+
+ <xsl:template match="products">
+ <html xmlns=" http://www.w3.org/2002/06/xhtml2"
+ xml:lang="en"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2002/06/xhtml2/ http://www.w3.org/MarkUp/SCHEMA/xhtml2.xsd">
+ <head>
+ <title>Trade Doubler Product Feed</title>
+ </head>
+ <body>
+ <xsl:apply-templates select="product"/>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="product">
+ <h><xsl:value-of select="name"/></h>
+ <p><xsl:value-of select="description"/></p>
+ <img>
+ <xsl:attribute name="src">
+ <xsl:value-of select="imageUrl"/>
+ </xsl:attribute>
+ </img>
+ <p>Price: <xsl:value-of select="price"/></p>
+ <p><a>
+ <xsl:attribute name="href"><xsl:value-of select="productUrl"/></xsl:attribute>
+ Buy Now
+ </a></p>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: forrest/trunk/whiteboard/forrest2/src/examples/affiliateProductCatalogue/src/xslt/tradeDoublerFeed-to-internal.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/forrest2/src/examples/helloWorld/src/forrestContext.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/src/examples/helloWorld/src/forrestContext.xml?view=auto&rev=476384
==============================================================================
--- forrest/trunk/whiteboard/forrest2/src/examples/helloWorld/src/forrestContext.xml (added)
+++ forrest/trunk/whiteboard/forrest2/src/examples/helloWorld/src/forrestContext.xml Fri Nov 17 16:12:01 2006
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+
+ <!-- FIXME: we should not be importing plugin definitions they should be
+ discovered and loaded automatically
+ <import resource="applicationContext-catalogueInputPlugin.xml" />
+ -->
+
+
+ <!-- ============================================= -->
+ <!-- Input Plugins -->
+ <!-- ============================================= -->
+
+ <bean id="org.apache.forrest.hellowWorld"
+ class="org.apache.forrest.test.core.plugins.input.HelloWorldInputPlugin" />
+
+ <!-- ============================================= -->
+ <!-- Output Plugins -->
+ <!-- ============================================= -->
+
+ <bean id="html"
+ class="org.apache.forrest.core.plugin.XSLTOutputPlugin">
+ <property name="pattern" value="html" />
+ <property name="xsltPath"
+ value="/xdocs/samples/xslt/internal-to-html.xsl" />
+ </bean>
+
+ <!-- ============================================= -->
+ <!-- Readers -->
+ <!-- ============================================= -->
+
+ <bean id="http" class="org.apache.forrest.reader.HTTPReader"></bean>
+ <bean id="file" class="org.apache.forrest.reader.FileReader"></bean>
+
+</beans>
Propchange: forrest/trunk/whiteboard/forrest2/src/examples/helloWorld/src/forrestContext.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/forrest2/src/examples/helloWorld/src/locationmap.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/src/examples/helloWorld/src/locationmap.xml?view=auto&rev=476384
==============================================================================
--- forrest/trunk/whiteboard/forrest2/src/examples/helloWorld/src/locationmap.xml (added)
+++ forrest/trunk/whiteboard/forrest2/src/examples/helloWorld/src/locationmap.xml Fri Nov 17 16:12:01 2006
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<locationmap>
+ <location pattern="helloWorld.xhtml2">
+ <source href="classpath:/xdocs/helloWorld.xhtml2"/>
+ </location>
+
+ <location pattern="helloWorld.html">
+ <source href="classpath:/xdocs/helloWorld.xhtml2"/>
+ </location>
+</locationmap>
\ No newline at end of file
Propchange: forrest/trunk/whiteboard/forrest2/src/examples/helloWorld/src/locationmap.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/forrest2/src/examples/helloWorld/src/xdocs/helloWorld.xhtml2
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/src/examples/helloWorld/src/xdocs/helloWorld.xhtml2?view=auto&rev=476384
==============================================================================
--- forrest/trunk/whiteboard/forrest2/src/examples/helloWorld/src/xdocs/helloWorld.xhtml2 (added)
+++ forrest/trunk/whiteboard/forrest2/src/examples/helloWorld/src/xdocs/helloWorld.xhtml2 Fri Nov 17 16:12:01 2006
@@ -0,0 +1,13 @@
+<?xml-stylesheet type="text/css"
+ href="http://www.w3.org/MarkUp/style/xhtml2.css"?>
+<html xmlns="http://www.w3.org/2002/06/xhtml2" xml:lang="en"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2002/06/xhtml2/ http://www.w3.org/MarkUp/SCHEMA/xhtml2.xsd"
+>
+ <head>
+ <title>XHTML 2 Hello World</title>
+ </head>
+ <body>
+ <h>Hello World</h>
+ </body>
+</html>
\ No newline at end of file
Added: forrest/trunk/whiteboard/forrest2/test/forrestContext.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/test/forrestContext.xml?view=auto&rev=476384
==============================================================================
--- forrest/trunk/whiteboard/forrest2/test/forrestContext.xml (added)
+++ forrest/trunk/whiteboard/forrest2/test/forrestContext.xml Fri Nov 17 16:12:01 2006
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+
+ <!-- ============================================= -->
+ <!-- Readers -->
+ <!-- ============================================= -->
+
+ <bean id="hello"
+ class="org.apache.forrest.test.core.readers.HelloReader" />
+
+ <!-- ============================================= -->
+ <!-- Input Plugins -->
+ <!-- ============================================= -->
+
+ <bean id="org.apache.forrest.hellowWorld"
+ class="org.apache.forrest.test.core.plugins.input.HelloWorldInputPlugin" />
+
+ <!-- ============================================= -->
+ <!-- Output Plugins -->
+ <!-- ============================================= -->
+
+ <bean id="html"
+ class="org.apache.forrest.core.plugin.XSLTOutputPlugin">
+ <property name="pattern" value="html" />
+ <property name="xsltPath"
+ value="/xdocs/samples/xslt/internal-to-html.xsl" />
+ </bean>
+
+ <!-- ============================================= -->
+ <!-- Readers -->
+ <!-- ============================================= -->
+
+ <bean id="http" class="org.apache.forrest.reader.HTTPReader"></bean>
+ <bean id="file" class="org.apache.forrest.reader.FileReader"></bean>
+
+</beans>
Propchange: forrest/trunk/whiteboard/forrest2/test/forrestContext.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/forrest2/test/locationmap.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/test/locationmap.xml?view=auto&rev=476384
==============================================================================
--- forrest/trunk/whiteboard/forrest2/test/locationmap.xml (added)
+++ forrest/trunk/whiteboard/forrest2/test/locationmap.xml Fri Nov 17 16:12:01 2006
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<locationmap>
+ <location pattern="xhtml/testPage.*">
+ <source href="classpath:/xdocs/samples/xhtml2/sample_simple.html"/>
+ </location>
+
+ <location pattern="xhtml/helloWorld.html">
+ <source href="hello:classpath:/xdocs/samples/xml/helloWorld.xml"/>
+ </location>
+</locationmap>
\ No newline at end of file
Propchange: forrest/trunk/whiteboard/forrest2/test/locationmap.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/forrest2/test/org/apache/forrest/test/core/TestController.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/test/org/apache/forrest/test/core/TestController.java?view=auto&rev=476384
==============================================================================
--- forrest/trunk/whiteboard/forrest2/test/org/apache/forrest/test/core/TestController.java (added)
+++ forrest/trunk/whiteboard/forrest2/test/org/apache/forrest/test/core/TestController.java Fri Nov 17 16:12:01 2006
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.forrest.test.core;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.forrest.core.Controller;
+import org.apache.forrest.core.document.AbstractOutputDocument;
+import org.apache.forrest.core.document.AbstractSourceDocument;
+import org.apache.forrest.core.document.InternalDocument;
+import org.apache.forrest.core.exception.LocationmapException;
+import org.apache.forrest.core.exception.ProcessingException;
+import org.apache.forrest.core.locationMap.Location;
+
+public class TestController extends TestCase {
+ static final String SOURCE_DOCUMENT_XHTML2_SIMPLE = "/xdocs/samples/xhtml2/sample_simple.html";
+
+ public static final String SOURCE_DOCUMENT_XHTML2_COMPLETE = "/xdocs/samples/xhtml2/sample_complete.html";
+
+ public static final String SOURCE_DOCUMENT_HELLO_WORLD = "/xdocs/samples/xml/helloWorld.xml";
+
+ public static final String XSLT_INTERNAL_TO_HTML = "/xdocs/samples/xslt/internal-to-html.xsl";
+
+ public static final String BASE_REQUEST_URI = "http://localhost:8888/xhtml/";
+
+ public static final String SOURCE_REQUEST_URI = BASE_REQUEST_URI
+ + "testPage.forestSource";
+
+ public static final String INTERNAL_REQUEST_URI = BASE_REQUEST_URI
+ + "testPage.forestInternal";
+
+ public static final String XHTML_REQUEST_URI = BASE_REQUEST_URI
+ + "testPage.html";
+
+ public static final String HELLO_WORLD_REQUEST_URI = BASE_REQUEST_URI
+ + "helloWorld.html";
+
+ private Controller controller;
+
+ @Override
+ public void setUp() {
+ try {
+ this.controller = new Controller("test/locationmap.xml",
+ "test/forrestContext.xml");
+ } catch (final Exception e) {
+ fail("Unable to set up tests: " + e.getMessage());
+ }
+ }
+
+ public void testSourceURLs() throws IOException, LocationmapException,
+ ProcessingException, URISyntaxException {
+ final List<Location> sourceURLs = this.controller
+ .getSourceLocations(new URI(XHTML_REQUEST_URI));
+ assertNotNull(sourceURLs);
+ // assertTrue(sourceURLs.get(0).getSourceURL().equals(firstSourceURL));
+ // assertTrue(sourceURLs.get(1).getSourceURL().equals(secondSourceURL));
+ }
+
+ public void testSourceDocuments() throws IOException, ProcessingException,
+ URISyntaxException {
+ final List<AbstractSourceDocument> documents = this.controller
+ .getSourceDocuments(new URI(XHTML_REQUEST_URI));
+ assertNotNull(documents);
+ // AbstractSourceDocument firstDoc = documents.get(0);
+ // AbstractSourceDocument secondDoc = documents.get(1);
+ // assertFalse(firstDoc.equals(secondDoc));
+ }
+
+ public void testInternalDocuments() throws IOException,
+ ProcessingException, URISyntaxException {
+ final List<AbstractSourceDocument> srcDocs = this.controller
+ .getSourceDocuments(new URI(XHTML_REQUEST_URI));
+ final List<InternalDocument> internalDocs = this.controller
+ .getInternalDocuments(new URI(XHTML_REQUEST_URI));
+ final AbstractSourceDocument firstSrcDoc = srcDocs.get(0);
+ // AbstractSourceDocument secondSrcDoc = srcDocs.get(1);
+ final InternalDocument firstIntDoc = internalDocs.get(0);
+ // InternalDocument secondIntDoc = internalDocs.get(1);
+ assertFalse(firstSrcDoc.equals(firstIntDoc));
+ // assertFalse(secondSrcDoc.equals(secondIntDoc));
+ // assertFalse(firstIntDoc.equals(secondIntDoc));
+ }
+
+ public void testProcessRequest() throws IOException, ProcessingException,
+ URISyntaxException {
+ final AbstractOutputDocument output = this.controller
+ .getOutputDocument(new URI(XHTML_REQUEST_URI));
+ assertNotNull(output);
+ assertTrue("Content is not as expected", output.getContentAsString()
+ .contains("<title>XHTML 2 Simple Sample Page"));
+ assertFalse("Content is not as expected", output.getContentAsString()
+ .contains("xml-stylesheet"));
+ }
+
+ public void testReader() throws ProcessingException, MalformedURLException,
+ URISyntaxException {
+ final List<AbstractSourceDocument> source = this.controller
+ .getSourceDocuments(new URI(HELLO_WORLD_REQUEST_URI));
+ assertEquals(
+ "Should have a single internal document for Hello World request",
+ 1, source.size());
+ final AbstractSourceDocument doc = source.get(0);
+ assertEquals("Document type read by Hello world is incorrect",
+ "org.apache.forrest.helloWorld", doc.getType());
+ }
+
+ public void testForrestSourceRequest() throws ProcessingException,
+ URISyntaxException, IOException {
+ final AbstractOutputDocument output = this.controller
+ .getOutputDocument(new URI(SOURCE_REQUEST_URI));
+ assertNotNull(output);
+ assertTrue("Content is not as expected", output.getContentAsString()
+ .contains("xml-stylesheet"));
+ }
+
+ public void testForrestInternalRequest() throws ProcessingException,
+ URISyntaxException, IOException {
+ final AbstractOutputDocument output = this.controller
+ .getOutputDocument(new URI(INTERNAL_REQUEST_URI));
+ assertNotNull(output);
+ assertTrue("Content is not as expected", output.getContentAsString()
+ .contains("Forrest Generated (Internal) Document"));
+ }
+
+}
Propchange: forrest/trunk/whiteboard/forrest2/test/org/apache/forrest/test/core/TestController.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/forrest2/test/org/apache/forrest/test/core/plugins/input/HelloWorldInputPlugin.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/test/org/apache/forrest/test/core/plugins/input/HelloWorldInputPlugin.java?view=auto&rev=476384
==============================================================================
--- forrest/trunk/whiteboard/forrest2/test/org/apache/forrest/test/core/plugins/input/HelloWorldInputPlugin.java (added)
+++ forrest/trunk/whiteboard/forrest2/test/org/apache/forrest/test/core/plugins/input/HelloWorldInputPlugin.java Fri Nov 17 16:12:01 2006
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.forrest.test.core.plugins.input;
+
+import org.apache.forrest.core.document.IDocument;
+import org.apache.forrest.core.document.InternalDocument;
+import org.apache.forrest.core.plugin.AbstractInputPlugin;
+
+/**
+ * A very simple plugin that alwasy produces a Hello World document, regardless
+ * of the input document.
+ *
+ */
+public class HelloWorldInputPlugin extends AbstractInputPlugin {
+
+ public static final String CONTENT = "<html xmlns=\"http://www.w3.org/2002/06/xhtml2\" xml:lang=\"en\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.w3.org/2002/06/xhtml2/ http://www.w3.org/MarkUp/SCHEMA/xhtml2.xsd\"> <head> <title>XHTML 2 Simple Sample Page</title> </head> <body> <h>Hello World</h> </body></html>";
+
+ public IDocument process(final IDocument doc) {
+ return new InternalDocument(CONTENT);
+ }
+}
Propchange: forrest/trunk/whiteboard/forrest2/test/org/apache/forrest/test/core/plugins/input/HelloWorldInputPlugin.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/forrest2/test/org/apache/forrest/test/core/readers/HelloReader.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/test/org/apache/forrest/test/core/readers/HelloReader.java?view=auto&rev=476384
==============================================================================
--- forrest/trunk/whiteboard/forrest2/test/org/apache/forrest/test/core/readers/HelloReader.java (added)
+++ forrest/trunk/whiteboard/forrest2/test/org/apache/forrest/test/core/readers/HelloReader.java Fri Nov 17 16:12:01 2006
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.forrest.test.core.readers;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.apache.forrest.core.document.AbstractSourceDocument;
+import org.apache.forrest.core.document.DefaultSourceDocument;
+import org.apache.forrest.core.locationMap.Location;
+import org.apache.forrest.reader.FileReader;
+
+public class HelloReader extends FileReader {
+
+ @Override
+ public AbstractSourceDocument read(final Location location) {
+ DefaultSourceDocument doc = null;
+ final URI psudeoURI = location.getSourceURI();
+ final String ssp = psudeoURI.getSchemeSpecificPart();
+ URI uri;
+ try {
+ uri = new URI(ssp);
+ location.setSourceURI(uri);
+ doc = (DefaultSourceDocument) super.read(location);
+ doc.setType("org.apache.forrest.helloWorld");
+ } catch (final URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return doc;
+ }
+
+}
Propchange: forrest/trunk/whiteboard/forrest2/test/org/apache/forrest/test/core/readers/HelloReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/forrest2/test/xdocs/samples/xhtml2/sample_simple.html
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/test/xdocs/samples/xhtml2/sample_simple.html?view=auto&rev=476384
==============================================================================
--- forrest/trunk/whiteboard/forrest2/test/xdocs/samples/xhtml2/sample_simple.html (added)
+++ forrest/trunk/whiteboard/forrest2/test/xdocs/samples/xhtml2/sample_simple.html Fri Nov 17 16:12:01 2006
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!--
+ Do we need to incorporate this somewhere ?-->
+
+<?xml-stylesheet type="text/css"
+ href="http://www.w3.org/MarkUp/style/xhtml2.css"?>
+<html xmlns="http://www.w3.org/2002/06/xhtml2" xml:lang="en"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2002/06/xhtml2/ http://www.w3.org/MarkUp/SCHEMA/xhtml2.xsd"
+>
+ <head>
+ <title>XHTML 2 Simple Sample Page</title>
+ <meta property="abstract">A second sample page, this one is really simple.</meta>
+ </head>
+ <body>
+
+ <h>This is a second sample page, it has nothing useful in it, but can be used
+ to illustrate aggregation. If the page you are viewing has more content than this
+ paragraph then this document has been aggregated with another.</h>
+
+ </body>
+</html>
\ No newline at end of file
Propchange: forrest/trunk/whiteboard/forrest2/test/xdocs/samples/xhtml2/sample_simple.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/forrest2/test/xdocs/samples/xml/helloWorld.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/test/xdocs/samples/xml/helloWorld.xml?view=auto&rev=476384
==============================================================================
--- forrest/trunk/whiteboard/forrest2/test/xdocs/samples/xml/helloWorld.xml (added)
+++ forrest/trunk/whiteboard/forrest2/test/xdocs/samples/xml/helloWorld.xml Fri Nov 17 16:12:01 2006
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<document>
+ <name>Hello</name>
+</document>
\ No newline at end of file
Propchange: forrest/trunk/whiteboard/forrest2/test/xdocs/samples/xml/helloWorld.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/forrest2/test/xdocs/samples/xslt/internal-to-html.xsl
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/test/xdocs/samples/xslt/internal-to-html.xsl?view=auto&rev=476384
==============================================================================
--- forrest/trunk/whiteboard/forrest2/test/xdocs/samples/xslt/internal-to-html.xsl (added)
+++ forrest/trunk/whiteboard/forrest2/test/xdocs/samples/xslt/internal-to-html.xsl Fri Nov 17 16:12:01 2006
@@ -0,0 +1,1072 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ - Copyright (c) 2004, Jonathan McGee
+ - All rights reserved.
+ -
+ - Redistribution and use in source and binary forms, with or without
+ - modification, are permitted provided that the following conditions
+ - are met:
+ -
+ - * Redistributions of source code must retain the above copyright
+ - notice, this list of conditions and the following disclaimer.
+ - * Redistributions in binary form must reproduce the above copyright
+ - notice, this list of conditions and the following disclaimer in
+ - the documentation and/or otherL materials provided with the
+ - distribution.
+ - * Neither the name of the author nor the names of his contributors
+ - may be used to endorse or promote products derived from this
+ - software without specific prior written permission.
+ - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ - COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ - ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/2002/06/xhtml2"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:html="http://www.w3.org/2002/06/xhtml2">
+ <!-- If imported into another stylesheet, allow the first level heading
+ - depth to be configured -->
+ <xsl:param name="xhtml-heading" select="1" />
+
+ <!-- Use XHTML 1.0 as the output schema -->
+ <xsl:output method="html" version="1.0" encoding="utf-8"
+ omit-xml-declaration="yes" media-type="text/html"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd" />
+
+ <!-- Copy elements by default -->
+ <xsl:template match="comment()">
+ <xsl:comment>
+ <xsl:value-of select="." />
+ </xsl:comment>
+ </xsl:template>
+
+ <!-- Do not process elements and attributes by default -->
+ <xsl:template match="html:*" />
+ <xsl:template match="html:*/@*" priority="0" />
+ <xsl:template match="html:*/@*" mode="insdel" priority="0" />
+ <xsl:template match="html:*/@*" mode="image" priority="0" />
+ <xsl:template match="html:*/@*" mode="quote" priority="0" />
+ <xsl:template match="html:*/@*" mode="link" priority="0" />
+
+ <!--
+ - XHTML Attribute Collections
+ -->
+
+ <!-- Core Attribute Collection -->
+ <xsl:template match="@class">
+ <xsl:param name="class" />
+ <xsl:attribute name="class">
+ <xsl:if test="$class">
+ <xsl:value-of select="$class" />
+ <xsl:text></xsl:text>
+ </xsl:if>
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+ <xsl:template match="@id|@title">
+ <xsl:attribute name="{local-name()}">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+
+ <!-- I18N Attribute Collection -->
+ <xsl:template match="@xml:lang">
+ <xsl:attribute name="lang">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+
+ <!-- Bi-directional Text Collection -->
+ <xsl:template match="@dir">
+ <!-- TODO: Need to handle lro and rlo. Not in HTML4 -->
+ <xsl:attribute name="dir">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+
+ <!-- Edit Collection -->
+ <xsl:template match="@edit" mode="insdel" />
+ <xsl:template match="@datetime" mode="insdel">
+ <xsl:attribute name="datetime">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+
+ <!-- Hypertext Attribute Collection -->
+ <xsl:template match="@href|@rel|@rev|@accesskey|@target"
+ mode="link">
+ <xsl:attribute name="{local-name()}">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+ <xsl:template match="@navindex" mode="link">
+ <xsl:attribute name="tabindex">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+ <!-- Make sure only one tag gets the cite attribute -->
+ <xsl:template match="@cite" mode="insdel">
+ <xsl:attribute name="cite">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+ <xsl:template match="@cite" mode="quote">
+ <xsl:if test="count(@edit)=0">
+ <xsl:attribute name="cite">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Embedding Attribute Collection -->
+ <xsl:template match="@src" mode="image">
+ <xsl:attribute name="src">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+ <xsl:template match="html:link/@type" mode="link">
+ <xsl:attribute name="type">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+
+ <!-- Image Map Attribute Collection -->
+ <xsl:template match="@usemap|@ismap" mode="image">
+ <xsl:attribute name="{local-name()}">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+
+ <!-- Style Attribute Collection -->
+ <xsl:template match="@style">
+ <xsl:attribute name="style">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+
+ <!--
+ - Block rendering templates
+ -->
+ <!-- If the edit attribute has been used, add a ins or del as appropriate -->
+ <xsl:template name="block">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- No edit attribute, just call next level -->
+ <xsl:when test="count(@edit)=0">
+ <xsl:call-template name="block-element">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- Edit attribute set to "deleted", create a del element -->
+ <xsl:when test="@edit='deleted'">
+ <del>
+ <xsl:apply-templates select="@*" mode="insdel">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="block-element">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </del>
+ </xsl:when>
+ <!-- Edit attribute set to "inserted", "changed", "moved", create an ins
+ - element -->
+ <xsl:otherwise>
+ <ins>
+ <xsl:apply-templates select="@*" mode="insdel">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="block-element">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </ins>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Create the element before any automatic inline children -->
+ <xsl:template name="block-element">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- The hr element is empty -->
+ <xsl:when test="$element='hr'">
+ <hr>
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ </hr>
+ </xsl:when>
+ <!-- Create element -->
+ <xsl:otherwise>
+ <xsl:element name="{$element}">
+ <xsl:if test="$class">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$class" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="block-quote">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- If the cite attribute appears without edit, create a quote element -->
+ <xsl:template name="block-quote">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- If no cite attribute or edit was defined, continue to next level -->
+ <xsl:when
+ test="(count(@cite)=0) or (count(@edit)!=0)
+ or ($element='blockquote')">
+ <xsl:call-template name="block-link">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- Create the quote element -->
+ <xsl:otherwise>
+ <q>
+ <xsl:apply-templates select="@*" mode="quote">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="block-link">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </q>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- If the href attribute appears, make a hyperlink -->
+ <xsl:template name="block-link">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- If no href attribute appears, continue to next level -->
+ <xsl:when test="count(@href)=0">
+ <xsl:call-template name="block-image">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- href has been used, so create an anchor -->
+ <xsl:otherwise>
+ <a>
+ <xsl:apply-templates select="@*" mode="link">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="block-image">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </a>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- If the src attribute appears, make an image -->
+ <xsl:template name="block-image">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- If no src attribute appears, continue to next level -->
+ <xsl:when test="count(@src)=0">
+ <xsl:apply-templates />
+ </xsl:when>
+ <!-- src has been used, so replace with an image -->
+ <xsl:otherwise>
+ <img alt="{.}">
+ <xsl:apply-templates select="@*" mode="image">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ </img>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--
+ - Inline rendering templates
+ -->
+ <!-- If the edit attribute has been used, add a ins or del as appropriate -->
+ <xsl:template name="inline">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- No edit attribute, just call next level -->
+ <xsl:when test="count(@edit)=0">
+ <xsl:call-template name="inline-quote">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- Edit attribute set to "deleted", create a del element -->
+ <xsl:when test="@edit='deleted'">
+ <del>
+ <xsl:apply-templates select="@*" mode="insdel">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="inline-quote">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </del>
+ </xsl:when>
+ <!-- Edit attribute set to "inserted", "changed", "moved", create an ins
+ - element -->
+ <xsl:otherwise>
+ <ins>
+ <xsl:apply-templates select="@*" mode="insdel">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="inline-quote">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </ins>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- If the cite attribute appears without edit, create a quote element -->
+ <xsl:template name="inline-quote">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- If no cite attribute or edit was defined, continue to next level -->
+ <xsl:when test="(count(@cite)=0) or (count(@edit)!=0)">
+ <xsl:call-template name="inline-link">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- Create the quote element -->
+ <xsl:otherwise>
+ <q>
+ <xsl:apply-templates select="@*" mode="quote">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="inline-link">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </q>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- If the href attribute appears, make a hyperlink -->
+ <xsl:template name="inline-link">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- If no href attribute appears, continue to next level -->
+ <xsl:when test="count(@href)=0">
+ <xsl:call-template name="inline-image">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- href has been used, so create an anchor -->
+ <xsl:otherwise>
+ <a>
+ <xsl:apply-templates select="@*" mode="link">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="inline-image">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </a>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- If the src attribute appears, make an image -->
+ <xsl:template name="inline-image">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- If no src attribute appears, continue to next level -->
+ <xsl:when test="count(@src)=0">
+ <xsl:call-template name="inline-element">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- src has been used, so replace with an image -->
+ <xsl:otherwise>
+ <img alt="{.}">
+ <xsl:apply-templates select="@*" mode="image">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ </img>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Finally, create the element (assuming not quote) -->
+ <xsl:template name="inline-element">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- If element is 'q' or 'a', it has already been made -->
+ <xsl:when test="($element='q') or ($element='a')">
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:apply-templates />
+ </xsl:when>
+ <!-- If element is 'br', make a span and put br at end -->
+ <xsl:when test="$element='br'">
+ <span class="line">
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:apply-templates />
+ <br />
+ </span>
+ </xsl:when>
+ <!-- Create element -->
+ <xsl:otherwise>
+ <xsl:element name="{$element}">
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:apply-templates />
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--
+ - List rendering templates
+ -->
+ <!-- If the edit attribute has been used, add a ins or del as appropriate -->
+ <xsl:template name="list">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- No edit attribute, just call next level -->
+ <xsl:when test="count(@edit)=0">
+ <xsl:call-template name="list-quote">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- Edit attribute set to "deleted", create a del element -->
+ <xsl:when test="@edit='deleted'">
+ <del>
+ <xsl:apply-templates select="@*" mode="insdel">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="list-quote">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </del>
+ </xsl:when>
+ <!-- Edit attribute set to "inserted", "changed", "moved", create an ins
+ - element -->
+ <xsl:otherwise>
+ <ins>
+ <xsl:apply-templates select="@*" mode="insdel">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="list-quote">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </ins>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- If the cite attribute appears without edit, create a quote element -->
+ <xsl:template name="list-quote">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- If no cite attribute or edit was defined, continue to next level -->
+ <xsl:when test="(count(@cite)=0) or (count(@edit)!=0)">
+ <xsl:call-template name="list-element">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- Create the quote element -->
+ <xsl:otherwise>
+ <blockquote>
+ <xsl:apply-templates select="@*" mode="quote">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="list-element">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </blockquote>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Create the element before any automatic inline children -->
+ <xsl:template name="list-element">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- If going to be replaced with an image, create a para instead -->
+ <xsl:when test="count(@src)">
+ <p>
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="list-link">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </p>
+ </xsl:when>
+ <!-- Create element and continue to children -->
+ <xsl:otherwise>
+ <xsl:element name="{$element}">
+ <xsl:if test="$class">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$class" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="count(html:summary)">
+ <xsl:attribute name="summary">
+ <xsl:value-of select="html:summary" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:apply-templates />
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- If the href and src are provided, make a linked image -->
+ <xsl:template name="list-link">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- If no href attribute appears, continue to next level -->
+ <xsl:when test="count(@href)=0">
+ <xsl:call-template name="list-image">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- href has been used, so create an anchor -->
+ <xsl:otherwise>
+ <a>
+ <xsl:apply-templates select="@*" mode="link">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="list-image">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </a>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- If the src attribute appears, make an image -->
+ <xsl:template name="list-image">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <img alt="{.}">
+ <xsl:apply-templates select="@*" mode="image">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ </img>
+ </xsl:template>
+
+ <!--
+ - List Item rendering templates
+ -->
+ <!-- Create the element before any automatic inline children -->
+ <xsl:template name="listitem">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:element name="{$element}">
+ <xsl:if test="$class">
+ <xsl:attribute name="class">
+ <xsl:value-of select="$class" />
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:apply-templates select="@*">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="listitem-insdel">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
+
+ <!-- If the edit attribute has been used, add a ins or del as appropriate -->
+ <xsl:template name="listitem-insdel">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- No edit attribute, just call next level -->
+ <xsl:when test="count(@edit)=0">
+ <xsl:call-template name="listitem-link">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- Edit attribute set to "deleted", create a del element -->
+ <xsl:when test="@edit='deleted'">
+ <del>
+ <xsl:apply-templates select="@*" mode="insdel">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="listitem-quote">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </del>
+ </xsl:when>
+ <!-- Edit attribute set to "inserted", "changed", "moved", create an ins
+ - element -->
+ <xsl:otherwise>
+ <ins>
+ <xsl:apply-templates select="@*" mode="insdel">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="listitem-quote">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </ins>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- If the cite attribute appears without edit, create a quote element -->
+ <xsl:template name="listitem-quote">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- If no cite attribute or edit was defined, continue to next level -->
+ <xsl:when test="(count(@cite)=0) or (count(@edit)!=0)">
+ <xsl:call-template name="listitem-link">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- Create the quote element -->
+ <xsl:otherwise>
+ <q>
+ <xsl:apply-templates select="@*" mode="quote">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="listitem-link">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </q>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- If the href attribute appears, make a hyperlink -->
+ <xsl:template name="listitem-link">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- If no href attribute appears, continue to next level -->
+ <xsl:when test="count(@href)=0">
+ <xsl:call-template name="listitem-image">
+ <xsl:with-param name="element" select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- href has been used, so create an anchor -->
+ <xsl:otherwise>
+ <a>
+ <xsl:apply-templates select="@*" mode="link">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ <xsl:call-template name="listitem-image">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:call-template>
+ </a>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- If the src attribute appears, make an image -->
+ <xsl:template name="listitem-image">
+ <xsl:param name="element" />
+ <xsl:param name="class" />
+ <xsl:choose>
+ <!-- If no src attribute appears, continue to next level -->
+ <xsl:when test="count(@src)=0">
+ <xsl:apply-templates />
+ </xsl:when>
+ <!-- src has been used, so replace with an image -->
+ <xsl:otherwise>
+ <img alt="{.}">
+ <xsl:apply-templates select="@*" mode="image">
+ <xsl:with-param name="element"
+ select="$element" />
+ <xsl:with-param name="class" select="$class" />
+ </xsl:apply-templates>
+ </img>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--
+ - XHTML Structure Module
+ -->
+ <!-- Add our Subversion/CVS Id to the root element -->
+ <xsl:template match="html:html">
+ <xsl:comment>
+ $Id: xhtml2html.xslt 127 2004-11-14 03:06:21Z etherealwake $
+ </xsl:comment>
+ <html>
+ <xsl:apply-templates select="@*" />
+ <xsl:apply-templates />
+ </html>
+ </xsl:template>
+ <!-- Specify namespace for metadata (if not using schema.X links) -->
+ <xsl:template match="html:html/@profile">
+ <xsl:attribute name="profile">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+ <!-- Add a generator tag to the head section -->
+ <xsl:template match="html:head">
+ <head>
+ <xsl:apply-templates select="@*" />
+ <meta http-equiv="Content-Type"
+ content="text/html; charset=utf-8" />
+ <xsl:apply-templates />
+ <xsl:if test="count(html:meta[@name='generator'])=0">
+ <meta name="generator"
+ content="Ethereal Wake XHTML2 to XHTML1 XSLT" />
+ </xsl:if>
+ </head>
+ </xsl:template>
+ <!-- <title> and <body> are pretty much copied as is -->
+ <xsl:template match="html:title|html:body">
+ <xsl:element name="{local-name()}">
+ <xsl:apply-templates select="@*" />
+ <xsl:apply-templates />
+ </xsl:element>
+ </xsl:template>
+
+ <!--
+ - XHTML Block Text Module
+ -->
+ <!-- Handle the elements practically unchanged since XHTML 1.0 -->
+ <xsl:template
+ match="html:address|html:blockquote|html:div|html:hr
+ |html:pre|html:hr">
+ <xsl:call-template name="block">
+ <xsl:with-param name="element" select="local-name(.)" />
+ </xsl:call-template>
+ </xsl:template>
+ <!-- In XHTML 2.0, paragraphs are a bit more sophisticated than in 1.X -->
+ <xsl:template match="html:p">
+ <xsl:choose>
+ <!-- If we have XHTML 1.0 block children, make us a div -->
+ <xsl:when
+ test="count(html:ul|html:ol|html:nl|html:dl|html:blockcode
+ |html:blockquote|html:pre|html:table)>0">
+ <xsl:call-template name="block">
+ <xsl:with-param name="element" select="'div'" />
+ <xsl:with-param name="class" select="'p'" />
+ </xsl:call-template>
+ </xsl:when>
+ <!-- If no block children, be a traditional paragraph -->
+ <xsl:otherwise>
+ <xsl:call-template name="block">
+ <xsl:with-param name="element" select="'p'" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!-- We will treat sections as simple <div>s of class section -->
+ <xsl:template match="html:section">
+ <xsl:call-template name="block">
+ <xsl:with-param name="element" select="'div'" />
+ <xsl:with-param name="class" select="'section'" />
+ </xsl:call-template>
+ </xsl:template>
+ <!-- <h> gets mapped to a h# based on how many parent sections -->
+ <xsl:template match="html:h">
+ <!-- Count the number of sections -->
+ <xsl:variable name="levelbase">
+ <xsl:value-of
+ select="count(ancestor::html:section)+$xhtml-heading" />
+ </xsl:variable>
+ <!-- Limit the heading element to h6 -->
+ <xsl:variable name="level">
+ <xsl:choose>
+ <xsl:when test="$levelbase > 6">6</xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$levelbase" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <!-- Create the appropriate element -->
+ <xsl:call-template name="block">
+ <xsl:with-param name="element" select="concat('h',$level)" />
+ </xsl:call-template>
+ </xsl:template>
+
+ <!--
+ - XHTML Inline Text Module
+ -->
+ <!-- Handle the elements practically unchanged since XHTML 1.0 -->
+ <xsl:template
+ match="html:abbr|html:cite|html:code|html:dfn|html:em
+ |html:kbd|html:samp|html:span|html:strong|html:sub|html:sup
+ |html:var">
+ <xsl:call-template name="inline">
+ <xsl:with-param name="element" select="local-name()" />
+ </xsl:call-template>
+ </xsl:template>
+ <!-- quote maps to the 'q' element from XHTML 1.0 -->
+ <xsl:template match="html:quote">
+ <xsl:call-template name="inline">
+ <xsl:with-param name="element" select="'q'" />
+ </xsl:call-template>
+ </xsl:template>
+ <!-- <l> is a more complex version of HTML's <br> -->
+ <xsl:template match="html:l">
+ <xsl:call-template name="inline">
+ <xsl:with-param name="element" select="'br'" />
+ </xsl:call-template>
+ </xsl:template>
+
+ <!--
+ - XHTML Hypertext Module
+ -->
+ <xsl:template match="html:a">
+ <xsl:call-template name="inline">
+ <xsl:with-param name="element" select="'a'" />
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template match="html:a/@id" mode="link">
+ <xsl:attribute name="id">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ <xsl:attribute name="name">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+
+ <!--
+ - XHTML List Module
+ -->
+ <xsl:template match="html:ul|html:ol|html:dl">
+ <xsl:call-template name="list">
+ <xsl:with-param name="element" select="local-name(.)" />
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template match="html:li|html:dt|html:dd">
+ <xsl:call-template name="listitem">
+ <xsl:with-param name="element" select="local-name(.)" />
+ </xsl:call-template>
+ </xsl:template>
+
+ <!--
+ - XHTML Linking Module
+ -->
+ <xsl:template match="html:link">
+ <link>
+ <xsl:apply-templates select="@*" mode="link" />
+ </link>
+ </xsl:template>
+ <xsl:template match="html:link/@media" mode="link">
+ <xsl:attribute name="media">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+ <xsl:template match="html:link/@xml:lang" mode="link">
+ <xsl:attribute name="hreflang">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+
+ <!--
+ - XHTML Metainformation Module
+ -->
+ <xsl:template match="html:meta">
+ <meta>
+ <xsl:attribute name="content">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ <xsl:apply-templates select="@*" />
+ </meta>
+ </xsl:template>
+ <xsl:template match="html:meta/@name">
+ <xsl:attribute name="name">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+
+ <!--
+ - XHTML Object Module
+ -->
+ <!--
+ - Ruby Module
+ -->
+ <!--
+ - XHTML Scripting Module
+ -->
+ <!--
+ - XHTML Style Sheet Module
+ -->
+ <xsl:template match="html:style">
+ <style>
+ <xsl:apply-templates select="@*" />
+ <xsl:apply-templates />
+ </style>
+ </xsl:template>
+ <xsl:template match="html:style/@media">
+ <xsl:attribute name="media">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+
+ <!--
+ - XHTML Tables Module
+ -->
+ <!-- Some table elements are pretty much left unchanged -->
+ <xsl:template
+ match="html:caption|html:col|html:colgroup|html:thead
+ |html:tfoot|html:tbody|html:tr">
+ <xsl:element name="{local-name()}">
+ <xsl:apply-templates select="@*" />
+ <xsl:apply-templates />
+ </xsl:element>
+ </xsl:template>
+ <xsl:template match="html:col/@span|html:colspan/@span">
+ <xsl:attribute name="span">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+ <!-- td and th are pretty much as they were -->
+ <xsl:template match="html:td|html:th">
+ <xsl:call-template name="listitem">
+ <xsl:with-param name="element" select="local-name()" />
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template
+ match="html:td/@abbr|html:td/@axis|html:td/@colspan
+ |html:td/@headers|html:td/@rowspan|html:td/@scope|html:th/@abbr
+ |html:th/@axis|html:th/@colspan|html:th/@headers|html:th/@rowspan
+ |html:th/@scope">
+ <xsl:attribute name="{local-name()}">
+ <xsl:value-of select="." />
+ </xsl:attribute>
+ </xsl:template>
+ <!-- The table element acts a lot like a list -->
+ <xsl:template match="html:table">
+ <xsl:call-template name="list">
+ <xsl:with-param name="element" select="'table'" />
+ </xsl:call-template>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: forrest/trunk/whiteboard/forrest2/test/xdocs/samples/xslt/internal-to-html.xsl
------------------------------------------------------------------------------
svn:eol-style = native