Created
February 6, 2014 14:28
-
-
Save lars-erik/8845196 to your computer and use it in GitHub Desktop.
Umbraco.config transformations for CMSImport
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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