upvote
for the record for anyone finding this in the future. this example works in firefox, but not in chromium. there it loads the page and the xsl stylesheet, but it displays an empty page.

a more elaborate example has the same results. chromium is empty. firefox works except that it looks like attributes to tags in the main content are ignored, which prevents css classes or links from working and images from loading. both work in the menu that is included from the template.

found it: the problem was that <xsl:copy><xsl:apply-templates/></xsl:copy> doesn't copy attributes. it needs to be:

    <xsl:template match="@*|node()">
      <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
    </xsl:template>
oh, and the inspector doesn't work with my example, making this thing hard to debug. xsl support in the browser appears to be limited. and unfortunately, if i can't get it to work in chrome, i won't be able to use it.
reply
you are right. xslt is not that bad. especially not for simple cases. your example would be just about enough for my website. thanks for that. i have used xslt before, but that was a long time ago.

however if you read through the comments there are a lot of people complaining, so they definitely see a downside to using xslt. as for longevity, well, a search led me to a chrome proposal to remove it that was made 10 years ago and ultimately rejected at the time. so maybe you are right about that too.

reply