Converting part of a multi-purpose XML file to RSS using XSL

Posted by Nate McCloud on Stack Overflow See other posts from Stack Overflow or by Nate McCloud
Published on 2010-04-19T06:34:38Z Indexed on 2010/04/19 6:53 UTC
Read the original article Hit count: 244

Filed under:
|
|

I have an XML file that I use for storing and displaying recipes that I collect, but that same XML file also has updates for the site at the top of it. How would I, say, use Recipes.xsl to transform Recipes.xml for display as an actual website, and use RecipesRSS.xsl to transform Recipes.xml into Recipes.rss?

Currently, my XML file is formatted something like this:

<book>
    <updates>
        <update when="2010-04-19">
            <format>
                <update>Formatting updates here, if any. Otherwise, omit the Format section.</update>
                ...
            </format>
            <recipes>
                <update>Recipe updates here, if any. Otherwise, omit the Recipes section.</update>
                ...
            </recipes>
        </update>
        ...
    </updates>
    <recipe name="Recipe Name">
        <from>Recipe source</from>
        <category>Recipe category</category>
        <ingredients>
            <ingredient>Recipe ingredient</ingredient>
            ...
        </ingredients>
        <instructions>
            <step>Recipe instructions go here.</step>
            ...
        </instructions>
        <notes>
            <note>Additional notes go here, if any. Otherwise, Notes section is omitted.</note>
            ...
        </notes>
    </recipe>
    ...
</book>

Any help would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xsl