I ve tried to access a page field's value from xslt but seem not successful. Im using new schema 4.5.2, the page field named Top Title, alias:topTitle and here is the xslt:
And with this version there comes a new XML schema. And in your code you are writexsltusingtheoldXMLschema.Thefact isthatfromversion4.5uses thenewXMLschema.
Thanks Dennis for those links and promply response, I will use a new schema syntax as documented. Just out of curious, how can i mark this thread as answered, so ppl can know.
Access page field value
Hi,
I ve tried to access a page field's value from xslt but seem not successful. Im using new schema 4.5.2, the page field named Top Title, alias:topTitle and here is the xslt:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets PS.XSLTsearch ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:value-of select ="$currentPage" disable-output-escaping="yes" />
<xsl:value-of select="$currentPage/data [@alias = 'topTitle']" disable-output-escaping="yes" />
</xsl:template>
</xsl:stylesheet>
The first xsl:value of is able to pull the all fields' value, but not the second with the specific topTitle name. Am i missing something here?
PS: i did put this marco on the master page with form runat = server tag. Is that make problem?
Thank you
Hi Ahn
You are using Umbraco version 4.5.2
And with this version there comes a new XML schema. And in your code you are write xslt using the old XML schema. The fact is that from version 4.5 uses the new XML schema.
So you can try something like:
This will hopefully help you.
/Dennis
Thank you Dennis, it WORKS.
I am glad to hear that Bogice.
But if you're more comfortable to work with the old XML schema, it is of course also possible to switch to the old XML schema if you are using version 4.5.2 of Umbraco
This can be done by following this guide:
http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/switching-between-old-and-new-schema
Or you can read about the new XML schema here:
http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/xslt-examples-updated-to-new-schema.
Another alternative could be the Umbraco videos about the new schema on umbraco.tv if you have access to this.
http://umbraco.com/help-and-support/video-tutorials/umbraco-fundamentals
But I'm glad I could help you
/Dennis
Thanks Dennis for those links and promply response, I will use a new schema syntax as documented. Just out of curious, how can i mark this thread as answered, so ppl can know.
I think you can mark this post as solved by running your mouse over where you can give high five.
If I remember correctly, but as I said, I'm not quite sure. :)
/Dennis
is working on a reply...