Warning, /libraries/binschema/cpp/xmltoodp/xmltocontent.xsl is written in an unsupported language. File is not indexed.
0001 <?xml version="1.0" encoding="UTF-8"?> 0002 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 0003 version="1.0" xmlns:xlink="http://www.w3.org/1999/xlink" 0004 xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 0005 xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 0006 xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" 0007 xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:h="http://www.w3.org/1999/xhtml"> 0008 0009 <xsl:strip-space elements="*" /> 0010 <xsl:output method="xml" indent="yes" /> 0011 0012 <xsl:template name="getPersistOffset"> 0013 <xsl:param name="persistId" /> 0014 <xsl:param name="userEditAtom" /> 0015 <xsl:variable name="persistDirectoryAtom" 0016 select="/ppt/PowerPointStructs/anon[@type='PowerPointStruct']/anon[@offset=$userEditAtom/offsetPersistDirectory][@type='PersistDirectoryAtom']" /> 0017 <xsl:variable name="entry" 0018 select="$persistDirectoryAtom/rgPersistDirEntry[persistId<=$persistId][persistId+cPersist>$persistId]" /> 0019 <xsl:variable name="offset" 0020 select="$entry/rgPersistOffset[position()=$persistId - ../persistId + 1]/anon" /> 0021 <xsl:choose> 0022 <!-- the right entry was found --> 0023 <xsl:when test="$offset"> 0024 <xsl:value-of select="$offset" /> 0025 </xsl:when> 0026 <!-- 0027 if it was not found there should be and another persistDirectoryAtom 0028 --> 0029 <xsl:when test="number($userEditAtom)>0"> 0030 <xsl:call-template name="getPersistOffset"> 0031 <xsl:with-param name="persistId" select="$persistId" /> 0032 <xsl:with-param name="userEditAtom" 0033 select="PowerPointStructs/anon[@type='PowerPointStruct']/anon[@offset=$userEditAtom/offsetLastEdit][@type='UserEditAtom']" /> 0034 </xsl:call-template> 0035 </xsl:when> 0036 <xsl:otherwise> 0037 <!-- error --> 0038 <xsl:message terminate="yes"> 0039 No offset was found for persistId 0040 <xsl:value-of select="$persistId" /> 0041 </xsl:message> 0042 </xsl:otherwise> 0043 </xsl:choose> 0044 </xsl:template> 0045 0046 <xsl:template match="/ppt"> 0047 <!-- parsing according to page 26 of [MS-PPT].pdf --> 0048 <xsl:variable name="currentUserAtom" select="CurrentUserStream/anon1" /> 0049 <!-- get the 'live' (last versions of) the important structures --> 0050 <xsl:variable name="userEditAtom" 0051 select="PowerPointStructs/anon[@type='PowerPointStruct']/anon[@offset=$currentUserAtom/offsetToCurrentEdit][@type='UserEditAtom']" /> 0052 <xsl:variable name="documentContainerOffset"> 0053 <xsl:call-template name="getPersistOffset"> 0054 <xsl:with-param name="persistId" select="$userEditAtom/docPersistIdRef" /> 0055 <xsl:with-param name="userEditAtom" select="$userEditAtom" /> 0056 </xsl:call-template> 0057 </xsl:variable> 0058 <xsl:variable name="documentContainer" 0059 select="PowerPointStructs/anon[@type='PowerPointStruct']/anon[@offset=$documentContainerOffset][@type='DocumentContainer']" /> 0060 <!-- 0061 <xsl:message terminate="yes"> hello <xsl:value-of 0062 select="$documentContainer/slideList/rgChildRec/slidePersistAtom/persistIdRef/anon"/> 0063 world </xsl:message> 0064 --> 0065 <office:document-content> 0066 <office:body> 0067 <office:presentation> 0068 <xsl:for-each 0069 select="$documentContainer/slideList/rgChildRec/slidePersistAtom"> 0070 <xsl:call-template name="processSlidePersistAtom"> 0071 <xsl:with-param name="documentContainer" select="$documentContainer" /> 0072 <xsl:with-param name="userEditAtom" select="$userEditAtom" /> 0073 </xsl:call-template> 0074 </xsl:for-each> 0075 </office:presentation> 0076 </office:body> 0077 </office:document-content> 0078 </xsl:template> 0079 0080 <xsl:template name="processSlidePersistAtom"> 0081 <xsl:param name="userEditAtom" /> 0082 <xsl:param name="documentContainer" /> 0083 <xsl:variable name="slideContainerOffset"> 0084 <xsl:call-template name="getPersistOffset"> 0085 <xsl:with-param name="persistId" select="persistIdRef/anon" /> 0086 <xsl:with-param name="userEditAtom" select="$userEditAtom" /> 0087 </xsl:call-template> 0088 </xsl:variable> 0089 <xsl:variable name="slideContainer" 0090 select="/ppt/PowerPointStructs/anon[@type='PowerPointStruct']/anon[@type='MasterOrSlideContainer']/anon[@offset=$slideContainerOffset][@type='SlideContainer']" /> 0091 <xsl:variable name="masterName" select="concat('master',$slideContainer/slideAtom/masterIdRef)" /> 0092 <draw:page> 0093 <xsl:attribute name="draw:master-page-name"> 0094 <xsl:value-of select="$masterName" /> 0095 </xsl:attribute> 0096 <xsl:apply-templates select="$slideContainer/drawing/OfficeArtDg/groupShape" /> 0097 </draw:page> 0098 </xsl:template> 0099 0100 <xsl:template match="*[@type='OfficeArtSpgrContainer']"> 0101 <xsl:param name="x" select="rgfb/anon/clientAnchor/*/left div 576" /> 0102 <xsl:param name="y" select="rgfb/anon/clientAnchor/*/top div 576" /> 0103 <xsl:param name="width" 0104 select="(number(rgfb/anon/clientAnchor/*/right)-$x) div 576" /> 0105 <xsl:param name="height" 0106 select="(number(rgfb/anon/clientAnchor/*/bottom)-$y) div 576" /> 0107 <xsl:param name="vx" select="rgfb/anon/shapeGroup/xLeft" /> 0108 <xsl:param name="vy" select="rgfb/anon/shapeGroup/yTop" /> 0109 <xsl:param name="vwidth" select="number(rgfb/anon/shapeGroup/xRight)-$vx" /> 0110 <xsl:param name="vheight" select="number(rgfb/anon/shapeGroup/yBottom)-$vy" /> 0111 <xsl:variable name="scale" select="$vwidth div $width" /> 0112 <draw:frame svg:x="{$x}in" svg:y="{$y}in" svg:width="{$width}in" 0113 svg:height="{$height}in"> 0114 <!-- 0115 if the first OfficeArtSpContainer has a clientAnchor, a new 0116 coordinate system is introduced. 0117 --> 0118 <xsl:attribute name="svg:viewBox"> 0119 <xsl:value-of select="concat($vx,' ',$vy,' ',$vwidth,' ',$vheight)"/> 0120 </xsl:attribute> 0121 <xsl:if test="rgfb[position()=1]/anon/clientAnchor"> 0122 <xsl:attribute name="svg:viewBox"> 0123 <xsl:value-of select="concat($vx,' ',$vy,' ',$vwidth,' ',$vheight)"/> 0124 </xsl:attribute> 0125 </xsl:if> 0126 <xsl:choose> 0127 <xsl:when test="rgfb[position()=1]/anon/clientAnchor"> 0128 <svg overflow="visible" x="{$x}" y="{$y}" width="{$width}" 0129 height="{$height}" viewBox="{$vx} {$vy} {$vwidth} {$vheight}" 0130 font-size="{100*$scale}%"> 0131 <xsl:apply-templates select="rgfb[position()>1]/anon" /> 0132 </svg> 0133 </xsl:when> 0134 <xsl:otherwise> 0135 <!-- <xsl:apply-templates select="rgfb[position()>1]/anon" />--> 0136 </xsl:otherwise> 0137 </xsl:choose> 0138 </draw:frame> 0139 </xsl:template> 0140 0141 <!-- 0142 <draw:frame draw:layer="layout" svg:x="{$x}in" svg:y="{$y}in" 0143 svg:width="{$width}in" svg:height="{$height}in"> <draw:text-box> 0144 <text:p>hello</text:p> </draw:text-box> </draw:frame> 0145 --> 0146 <xsl:template match="atoms[@type='TextContainer']"> 0147 <draw:frame draw:layer="layout"> 0148 <xsl:choose> 0149 <xsl:when test="textHeaderAtom/textType=0"> 0150 <xsl:attribute name="presentation:class">title</xsl:attribute> 0151 </xsl:when> 0152 </xsl:choose> 0153 <draw:text-box> 0154 <text:p> 0155 <xsl:value-of select="text/textChars" /> 0156 </text:p> 0157 </draw:text-box> 0158 </draw:frame> 0159 </xsl:template> 0160 0161 </xsl:stylesheet>