I'm using the same method from Business Website Starter Pack to save a vCard. But I was wondering how to change the filename e.g. to nodeName, so they don't all have the same name?
I have a problem with getting æøå when downloading the vCard and opening it in Outlook og Windows Live Mail. I guess it's something about the missing utf-8 charset, so I tried to add it, but it doesn't seem to change anything:
Change filename of vCard
Hi..
I'm using the same method from Business Website Starter Pack to save a vCard.
But I was wondering how to change the filename e.g. to nodeName, so they don't all have the same name?
<msxml:script language="CSharp" implements-prefix="gecko">
<msxml:assembly name="System.Web" />
<msxml:using namespace="System.Web" />
<![CDATA[
public void changeOutPut(String ContentType, String FileName) {
HttpContext.Current.Response.ContentType = ContentType;
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + FileName);
}
]]>
</msxml:script>
.......
<xsl:value-of select="gecko:changeOutPut('text/calendar','vCard.vcf')" />
Bjarne
Hi,
Something like this (not tested)
<msxml:script language="CSharp" implements-prefix="gecko">
<msxml:assembly name="System.Web" />
<msxml:using namespace="System.Web" />
<![CDATA[
public void changeOutPut(String ContentType, String FileName) {
HttpContext.Current.Response.ContentType = ContentType;
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + FileName + ".vcf");
}
]]>
</msxml:script>
.......
<xsl:value-of select="gecko:changeOutPut('text/calendar',@nodeName)" />
RIch
Hi Bjarne,
You can just take the filename from wherever you have the info, e.g. the @nodeName of a Document or similar:
BTW: You should check out Doug's blogpost on moving <msxsl:script> blocks into the App_Code folder.
/Chriztian
Thank you both...
I needed to do this:
<msxml:script language="CSharp" implements-prefix="gecko">
<msxml:assembly name="System.Web" />
<msxml:using namespace="System.Web" />
<![CDATA[
public void changeOutPut(String ContentType, String FileName) {
HttpContext.Current.Response.ContentType = ContentType;
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + FileName + ".vcf");
}
]]>
</msxml:script>
.......
<xsl:value-of select="gecko:changeOutPut('text/calendar', $currentPage/@nodeName)" />
If I hadn't the $currentPage with it was saved as vcf.ics ..
Bjarne
I'm using a child node as vCard, where there on the parent node: http://ak-security.dk/profil/steffen-agerskov.aspx just is inserted a normal link and the child node is picked..
is there something you can do, so the url looks like a vCard (.vcf) instead of the template/node (.aspx) ?
Bjarne
I have a problem with getting æøå when downloading the vCard and opening it in Outlook og Windows Live Mail.
I guess it's something about the missing utf-8 charset, so I tried to add it, but it doesn't seem to change anything:
<?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:gecko="urn:gecko-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"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets gecko">
<xsl:output method="text" omit-xml-declaration="yes"/>
<msxml:script language="CSharp" implements-prefix="gecko">
<msxml:assembly name="System.Web" />
<msxml:using namespace="System.Web" />
<![CDATA[
public void changeOutPut(String ContentType, String FileName) {
HttpContext.Current.Response.ContentType = ContentType;
HttpContext.Current.Response.AddHeader("content-type", "text/x-vcard;charset=utf-8");
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + FileName + ".vcf");
}
]]>
</msxml:script>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:text>BEGIN:VCARD</xsl:text><xsl:text>
</xsl:text>
<xsl:text>VERSION:2.1</xsl:text><xsl:text>
</xsl:text>
<xsl:text>N:</xsl:text><xsl:value-of select="$currentPage/vcardLastName" /><xsl:text>;</xsl:text><xsl:value-of select="$currentPage/vcardFirstName" /><xsl:text>
</xsl:text>
<xsl:text>FN:</xsl:text><xsl:value-of select="$currentPage/vcardFirstName" /><xsl:text> </xsl:text><xsl:value-of select="$currentPage/vcardLastName" /><xsl:text>
</xsl:text>
<xsl:text>TITLE:</xsl:text><xsl:value-of select="$currentPage/vcardTitle" /><xsl:text>
</xsl:text>
<xsl:text>ADR;INTL;PARCEL;HOME:</xsl:text><xsl:text>;;</xsl:text><xsl:value-of select="$currentPage/vcardAddress" /><xsl:text>;</xsl:text><xsl:value-of select="$currentPage/vcardCity" /><xsl:text>;;</xsl:text><xsl:value-of select="$currentPage/vcardZipCode" /><xsl:text>;Danmark</xsl:text><xsl:text>
</xsl:text>
<xsl:text>LABEL;HOME;ENCODING=QUOTED-PRINTABLE:</xsl:text><xsl:value-of select="$currentPage/vcardAddress" /><xsl:text>=0D=0A=</xsl:text><xsl:value-of select="$currentPage/vcardCity" /><xsl:text>, </xsl:text><xsl:value-of select="$currentPage/vcardZipCode" /><xsl:text>=0D=0A=Danmark</xsl:text><xsl:text>
</xsl:text>
<xsl:text>TEL;CELL:</xsl:text><xsl:value-of select="$currentPage/vcardPhone" /><xsl:text>
</xsl:text>
<xsl:text>EMAIL;INTERNET:</xsl:text><xsl:value-of select="$currentPage/vcardEmail" /><xsl:text>
</xsl:text>
<xsl:text>ORG: AK-Security</xsl:text><xsl:text>
</xsl:text>
<xsl:text>URL;WORK: http://www.ak-security.dk</xsl:text><xsl:text>
</xsl:text>
<xsl:text>END:VCARD</xsl:text><xsl:text>
</xsl:text>
<xsl:value-of select="gecko:changeOutPut('text/x-vcard', $currentPage/@nodeName)" />
</xsl:template>
</xsl:stylesheet>
Related to this site http://softwareas.com/vcard-for-developers it should have the utf-8 charset, which I have added.. or is something wrong?
When I open it up in e.g. Windows Live Mail I get æ instead of æ and ø instead of ø.
Bjarne
is working on a reply...