Skip to content

Instantly share code, notes, and snippets.

@lars-erik
Created February 6, 2014 14:28
Show Gist options
  • Save lars-erik/8845196 to your computer and use it in GitHub Desktop.
Save lars-erik/8845196 to your computer and use it in GitHub Desktop.
Umbraco.config transformations for CMSImport
SELECT
image.id,
replace(dataNvarchar, '/media', '/oldmedia') filename
FROM [umbracoNode] as image
inner join cmscontent on
cmscontent.nodeid = image.id
inner join cmscontenttype on
contenttype = cmscontenttype.nodeid
inner join cmsPropertyData on
cmsPropertyData.contentNodeId = image.id
and
propertytypeid in (6, 24)
where nodeObjectType = 'B796F64C-1F99-4FFB-B886-4BF4BC011A9C'
and
not nullif(dataNvarchar, '') is null
for xml auto
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="xml" indent="yes"
cdata-section-elements="heading body listText summary sidebarwidget-1"
/>
<xsl:template match="@* | node()">
<xsl:choose>
<xsl:when test="name() = 'images'">
</xsl:when>
<xsl:when test="name() = 'mainImage' or name() = 'listImage' or name() = 'sidebarImage1'">
<xsl:copy>
<xsl:variable name="imageId" select="text()"/>
<xsl:value-of select="//image[@id=$imageId]/@filename"/>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:attribute name="oldId"><xsl:value-of select="@id"/></xsl:attribute>
<xsl:attribute name="oldParentId"><xsl:value-of select="@parentID"/></xsl:attribute>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment