You need to sign in to do that
Don't have an account?
tggagne
Trying to create XSLT: Save error: Component /apexcomponent/xsl__stylesheet does not exist
I need to generate both an XML doc and XSLT from inside VF.
I can create an XML easily eough, but I'm having trouble with the XSLT.
I've stripped-down the XSLT to its bare essentials.
<apex:page contentType="text/xml" showHeader="false" sidebar="false" expires="1"> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> </xsl:stylesheet> </apex:page>
When I try saving it, I get, "Save error: Component /apexcomponent/xsl__stylesheet does not exist."
Does anyone know if such a thing can be done, or why the code above won't save?
Somewhat satisfactory work-around.
I created a component as:
<apex:component controller="AquariusXMLController">{!xmlpi}
{!stylesheetReference}
<apex:componentBody />
</apex:component>
The controller provides the two merge fields which as you might expect expand to:
<?xml version="1.0"?> and <?xml-stylesheet type="text/xsl" href="AquariusXSLT" ?> respectively.
The XSLT file resembles:
<apex:page contentType="text/xml" showHeader="false" sidebar="false" cache="true">
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template>.....</xsl:template>
</xsl:stylesheet>
</apex:page>
The version attributes above are important. Firefox and Opera mobile crashed without them. xsltproc was useful in finding this.
All Answers
Why do you need a XSLT stylesheet within the apex page? if you need it for some kind of transformation, cant you save it as an external resource and refer to it in your page?
I could, but I'd rather have it exist as a page so I might auto-generate some of its content and be able to edit it inside Develop->Pages than have to load zip files.
Somewhat satisfactory work-around.
I created a component as:
<apex:component controller="AquariusXMLController">{!xmlpi}
{!stylesheetReference}
<apex:componentBody />
</apex:component>
The controller provides the two merge fields which as you might expect expand to:
<?xml version="1.0"?> and <?xml-stylesheet type="text/xsl" href="AquariusXSLT" ?> respectively.
The XSLT file resembles:
<apex:page contentType="text/xml" showHeader="false" sidebar="false" cache="true">
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template>.....</xsl:template>
</xsl:stylesheet>
</apex:page>
The version attributes above are important. Firefox and Opera mobile crashed without them. xsltproc was useful in finding this.