xslt-1.0 相关问题

将此标记用于特定于XSL转换版本1.0的问题,而不是其他版本。

在 XSL FO 中创建多级列表

我正在尝试创建多级列表输出。我在 XML 1.0 中使用通过 apache FOP 运行的 XSLT 我使用如下所示的 XML 输入,其中 procedureL 中有许多不同的过程...

回答 1 投票 0

另一个属性的属性值总和

我有以下xml 我有以下 xml <?xml version="1.0" encoding="UTF-8"?> <Containers> <ContainerGroup Type="40HC" Quantity="1"/> <ContainerGroup Type="40HC" Quantity="3"/> <ContainerGroup Type="42PL" Quantity="4"/> <ContainerGroup Type="40HC" Quantity="2"/> </Containers> 需要写一段xsl 1.0代码,这样结果就是 <Sum>40HC-6||42PL-4</Sum> 尝试使用下面的代码但没有成功 <xsl:for-each select="Containers/ContainerGroup/@Type"> <xsl:variable name="sumQuantity" select="sum(@Quantity)" /> <xsl:if test="position() != 1">||</xsl:if> <xsl:value-of select="concat(@Type,'-',$sumQuantity)"/> </xsl:for-each> 编辑1 使用 Muenchian 方法,在下面的代码中开发,但它不起作用 <xsl:key name="container-by-type" match="Containers/ContainerGroup" use="Containers/ContainerGroup/@Type"/> <xsl:template name="sumQuantity"> <xsl:for-each select="//Containers/ContainerGroup[generate-id() = generate-id(key('container-by-type', Containers/ContainerGroup/@Type)[1])]"> <xsl:variable name="grp" select="key('container-by-type', Containers/ContainerGroup/@Type)" /> <xsl:if test="position() != 1">||</xsl:if> <xsl:value-of select="concat(Containers/ContainerGroup/@Type,'-',sum($grp/@Quantity))"/> </xsl:for-each> </xsl:template> 您有几个错误,最明显的是在需要相对路径的情况下使用绝对路径。我们也看不到您命名的模板在哪里被调用以及从什么上下文中调用。 比较: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:key name="container-by-type" match="ContainerGroup" use="@Type"/> <xsl:template match="/Containers"> <Sum> <!-- create a group for each distinct type --> <xsl:for-each select="ContainerGroup[generate-id()=generate-id(key('container-by-type', @Type)[1])]"> <!-- output the type --> <xsl:value-of select="@Type" /> <xsl:text>-</xsl:text> <!-- sum the curent group's quantities --> <xsl:value-of select="sum(key('container-by-type', @Type)/@Quantity)" /> <xsl:if test="position()!=last()">||</xsl:if> </xsl:for-each> </Sum> </xsl:template> </xsl:stylesheet>

回答 1 投票 0

如何使用 XSLT 将格式化 HTML 中的关键字替换为 HTML 标记?

我正在尝试向存储在 XML 文档中的 HTML 格式文本中的关键字添加超链接。 XML 片段: 注释标题 注释正文等等关键字等等。 我正在尝试向 XML 文档中存储的 HTML 格式文本中的关键字添加超链接。 XML 片段: <NoteText>Heading of note<br/> Body of note blah blah keyword blah blah.<br/> May contain more lines.</NoteText> 所需输出: Heading of note<br/> Body of note blah blah <a href="http://127.0.0.1/">keyword</a> blah blah.<br/> May contain more lines. XSLT 模板的原始尝试。这会添加 HTML 标签,但会丢失所有现有格式。 <xsl:template name="string-replace-all"> <xsl:param name="text" /> <xsl:param name="replace" /> <xsl:param name="by" /> <xsl:choose> <xsl:when test="contains($text, $replace)"> <xsl:value-of select="substring-before($text,$replace)" disable-output-escaping="yes" /> <xsl:value-of select="$by" disable-output-escaping="yes" /> <xsl:call-template name="string-replace-all"> <xsl:with-param name="text" select="substring-after($text,$replace)" /> <xsl:with-param name="replace" select="$replace" /> <xsl:with-param name="by" select="$by" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$text" disable-output-escaping="yes" /> </xsl:otherwise> </xsl:choose> </xsl:template> 第二次尝试。这会保留现有格式,但添加新的 HTML 作为显示文本而不是功能标记。 <xsl:template name="string-replace-formatted"> <xsl:param name="text" /> <xsl:param name="replace" /> <xsl:param name="by" /> <xsl:choose> <xsl:when test="contains($text, $replace)"> <xsl:copy-of select="substring-before($text,$replace)" /> <xsl:copy-of select="$by" /> <xsl:call-template name="string-replace-formatted"> <xsl:with-param name="text" select="substring-after($text,$replace)" /> <xsl:with-param name="replace" select="$replace" /> <xsl:with-param name="by" select="$by" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:copy-of select="$text" /> </xsl:otherwise> </xsl:choose> </xsl:template> 所以,我正在寻找两全其美的方法 - 如何保留现有的 HTML 标签并添加新的 HTML 标签?是否可以使用像我这里这样的通用模板(以便它可以重用于其他标签),或者我是否需要一个单一用途的模板,该模板具有找到和替换的字符串的常量值? 使用 xslt 1.0 你可以尝试这样的事情: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <xsl:template match="NoteText//text()"> <xsl:call-template name="make-link"> <xsl:with-param name="linktext" select="'keyword'"/> <xsl:with-param name="link" > <a href="http://127.0.0.1/"/> </xsl:with-param> </xsl:call-template> </xsl:template> <xsl:template name="make-link"> <xsl:param name="text" select="." /> <xsl:param name="linktext" /> <xsl:param name="link" /> <xsl:choose> <xsl:when test="contains($text, $linktext)"> <xsl:copy-of select="substring-before($text,$linktext)" /> <a href="http://127.0.0.1/"> <xsl:value-of select="$linktext" /> </a> <xsl:call-template name="make-link"> <xsl:with-param name="text" select="substring-after($text,$linktext)" /> <xsl:with-param name="linktext" select="$linktext" /> <xsl:with-param name="link" select="$link" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$text" /> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> 这对于 XSLT 3 来说是一项简单的工作: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" exclude-result-prefixes="#all" expand-text="yes"> <xsl:template match="NoteText//text()"> <xsl:apply-templates select="analyze-string(., 'keyword')" mode="wrap-match"/> </xsl:template> <xsl:template match="fn:match" mode="wrap-match"> <a href="http://localhost/">{.}</a> </xsl:template> <xsl:mode on-no-match="shallow-copy"/> </xsl:stylesheet> XSLT 3 可用于 Java 平台的 Saxon、.NET 平台、用于 Python/C/C++ 的 SaxonC、用于 Node.js 和浏览器的 SaxonJS。

回答 2 投票 0

如何从 XML 输出中的显示中排除一个空元素 (XSLT 1.0)

我正在寻找一种方法来防止显示没有属性的特定空标签(如果它为空)。我只能找到将其应用于整个 XSLT 文档的解决方案,这不是......

回答 1 投票 0

使用 xslt 操作 xml 文件中元素中的值

我希望能够删除或替换 xml 文件中元素值内不必要的文本,并且我希望使用 XSLT 转换来实现此目的。 在此示例文件中,我想删除特定的

回答 1 投票 0

使用 xslt 替换 xml 文件中元素中的值

我想删除 xml 文件中元素值内不必要的文本,并且我想使用 XSLT 转换来做到这一点。 在此示例文件中,我想删除特定标签,例如 、 我想删除 xml 文件中元素值内不必要的文本,并且我想使用 XSLT 转换来做到这一点。 在此示例文件中,我想删除 <br>、<preffix>、<suffix> 元素内部值中的特定标签。会有很多<Value>元素。我不想更改此文件的结构,因此这应该类似于副本,但具有删除特定文本的逻辑。我尝试使用模板和复制,但不知何故我无法将它们连接在一起。 如果你们中的任何人可以帮助我或给我应该遵循的提示,我将不胜感激。 <Product> 输出文件应如下所示: <ProductInfo> <Products> <Product> <Name>xyz</Name> <Values> <Value><br/>test</Value> <-- remove <br/> <Value><preffix/>test2</Value> <-- remove <preffix> <Value><suffix/>test3</Value> <-- remove <suffix/> </Values> </Product> <Product> <Name>xyz</Name> <Values> <Value><br/>test</Value> <-- remove <br/> <Value><preffix/>test2</Value> <-- remove <preffix> <Value><suffix/>test3</Value> <-- remove <suffix/> </Values> </Product> </Products> </ProductInfo> 以下样式表: XSLT 1.0 <ProductInfo> <Products> <Product> <Name>xyz</Name> <Values> <Value>test</Value> <Value>test2</Value> <Value>test3</Value> </Values> </Product> <Product> <Name>xyz</Name> <Values> <Value>test</Value> <Value>test2</Value> <Value>test3</Value> </Values> </Product> </Products> </ProductInfo> 将通过仅返回<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:strip-space elements="*"/> <!-- identity transform --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="Value"> <xsl:copy> <xsl:value-of select="."/> </xsl:copy> </xsl:template> </xsl:stylesheet> 元素中包含的任何标记字符串值 - 即“按文档顺序排列元素节点的所有文本节点后代的字符串值的串联”。 您可以通过身份转换以及与您要删除/删除的内容相匹配的附加空模板来完成此操作。 Value 您可以为每个匹配模式使用单独的空匹配模板,而不是使用 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml" indent="yes"/> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <!--empty template matching the elements that we want to drop and not appear in the result--> <xsl:template match="Value/br | Value/prefix | Value|suffix"/> </xsl:stylesheet> 联合。此外,如果您想删除出现在 | 元素内部的所有元素,您可以使用 Value 进行更通用的匹配。

回答 2 投票 0

使用 XSLT1.0 将 JSON 转换为 XML

我想使用XSLT1.0将属于XML一部分的JSON转换为XML结构(原因是我们的应用程序仅支持XSLT1.0版本)。 有人可以检查一下并让我知道吗?那个...

回答 1 投票 0

XSL 匹配 xsl:variable 元素并更改 @select 属性

我需要复制完整的xsl文件,但更改特定变量的@select属性的特定值。 我的伪代码想法: &l...

回答 1 投票 0

在 xsl 转换后在 xml 输出中获取转义的 " ("e;) 和 ' (') 字符

我需要使用 XSLT 1.0 将 xml 文件中的 " 和 ' 转义为 " ',因为使用系统无法处理 xml 元素内的这些字符。 我遇到了两个问题...

回答 1 投票 0

有条件地设置变量而不切割祖先轴

我在.NET下有xslt/xpath v1.0堆栈。 我想有条件地设置变量 $myVar: 我在.NET下有xslt/xpath v1.0堆栈。 我想有条件地设置一个变量$myVar: <xsl:variable name="myVar"> <xsl:if test="$case ='1'"> <xsl:copy-of select="$otherVarA/down/the/rabbit/hole"/> </xsl:if> <xsl:if test="$case ='2'"> <xsl:copy-of select="$otherVarB/down/the/rabbit/hole"/> </xsl:if> <xsl:if test="$case ='3'"> <xsl:copy-of select="$otherVarC/down/the/rabbit/hole"/> </xsl:if> </xsl:variable> 后来有向下访问:$myVar/go/deeper,但也有像这样的向上访问$myVar/ancestor::rabbit。 显然<xsl:copy-of select="$myVar/down/to/rabbit/hole"/>切断了向上的路径。 如何设置$myVar方式才能访问祖先轴? 我知道<xsl:variable name=... select=... 不会切割向上的轴。 您遇到的第一个问题是,在 XSLT 1.0 中,当您在变量中使用 xsl:copy-of 时,变量本身将是“结果树片段”类型,因此您将无法使用像 这样的 xpath 表达式$myVar/down/to/rabbit/hole就可以了。您需要使用“节点集”扩展函数将其从结果树片段转换为可以访问其中节点的节点集(请参阅https://www.xml.com/pub/a/ 2003/07/16/nodeset.html 了解更多详情)。 但是,这并不能解决你关于获取祖先的主要问题。因为您使用的是 xsl:copy-of,所以您只能访问已复制的节点,而无法访问原始 XML 中未复制的任何祖先节点。 我怀疑你的真实情况可能更复杂,但鉴于你在问题中所显示的内容,你可以像这样定义变量: <xsl:variable name="myVar" select="$otherVarA[$case ='1']/down/the/rabbit/hole |$otherVarB[$case ='2']/down/the/rabbit/hole |$otherVarC[$case ='3']/down/the/rabbit/hole"/> 这样,您现在引用原始 XML 中的节点,而不是进行复制,因此您不需要节点集函数,并且祖先函数可以访问原始 XML 中的所有祖先。 这确实假设您的 $otherVarA/B/C 变量是对原始 XML 的引用,而不是使用 xsl:copy-of 创建的结果树片段。 请参阅 http://xsltfiddle.liberty-development.net/bwdwrw 了解人为示例。

回答 1 投票 0

无法检测 XSLT-1 脚本中的值计数

XML XML <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="CongDB--Congregation Report.xsl"?> <CongregationDatabaseReport> <Settings> <LanguageCode>en</LanguageCode> <Direction>ltr</Direction> <SortOrder>true</SortOrder> <SortField>Congregation</SortField> <ReportMode>Simple</ReportMode> </Settings> <CongregationList> <Congregation>Cong1</Congregation> <Congregation>Cong2</Congregation> </CongregationList> </CongregationDatabaseReport> 外部 CongDB XML <?xml version="1.0" encoding="utf-8"?> <CongregationDatabase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1" xmlns="http://www.publictalksoftware.co.uk/msa"> <Congregations> <Congregation LocalCong="false"> <Name>Cong1</Name> <LastInvited>2011-09-27</LastInvited> </Congregation> <Congregation LocalCong="false"> <Name>Cong2</Name> <LastInvited>2011-09-27</LastInvited> </Congregation> <Congregation LocalCong="false"> <Name>Cong3</Name> <LastInvited>2011-09-27</LastInvited> </Congregation> <Congregation LocalCong="false"> <Name>Cong4</Name> <LastInvited>2011-09-27</LastInvited> </Congregation> <Congregation LocalCong="false"> <Name>Cong5</Name> <LastInvited>2011-09-27</LastInvited> </Congregation> </Congregations> </CongregationDatabase> XSL <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msa="http://www.publictalksoftware.co.uk/msa"> <xsl:output method="html" indent="yes" version="4.01" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/> <xsl:variable name="CongDB" select="document('MSA_CongregationDatabase.XML')"/> <xsl:template match="/"> <html> <head> <title> <xsl:text>Congregation Report</xsl:text> </title> <style type="text/css"> * { font-family: PT Sans; font-size: 12pt; } h1 { font-size: 14pt; text-align: center; border: solid 1px black; } h2 { text-align: center; background-color: black; color: white; padding: 2mm; } table { border: solid 1px black; border-collapse: collapse; } td { border: solid black 1px; padding: 1mm; } </style> </head> <body> <h1> <xsl:text>Congregation Report</xsl:text> </h1> <xsl:variable name="strSortOrder"> <xsl:choose> <xsl:when test="//Settings/SortOrder='true'"> <xsl:text>ascending</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>descending</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:value-of select="$strSortOrder"/> <xsl:value-of select="//Settings/SortField"/> <xsl:if test="//Settings/ReportMode='Simple'"> <table> <xsl:if test="//Settings/SortField='Congregation'"> <xsl:for-each select="$CongDB/msa:CongregationDatabase/msa:Congregations/msa:Congregation"> <xsl:sort select="msa:Name" data-type="text" order="{$strSortOrder}"/> <xsl:apply-templates select="."/> <xsl:value-of select="count(CongregationDatabaseReport/CongregationList[Congregation=current()])"/> <!--<xsl:if test="count(CongregationDatabaseReport/CongregationList[Congregation=current()]) = 1"> <xsl:apply-templates select="."/> </xsl:if>--> </xsl:for-each> </xsl:if> <xsl:if test="//Settings/SortField='Date'"> <xsl:for-each select="$CongDB/msa:CongregationDatabase/msa:Congregations/msa:Congregation"> <xsl:sort select="msa:LastInvited" data-type="text" order="{$strSortOrder}"/> <xsl:apply-templates select="."/> <!--<xsl:if test="count(CongregationDatabaseReport/CongregationList[Congregation=current()]) = 1"> <xsl:apply-templates select="."/> </xsl:if>--> </xsl:for-each> </xsl:if> </table> </xsl:if> </body> </html> </xsl:template> <xsl:template match="msa:Congregation"> <tr> <td> <xsl:value-of select="msa:Name"/> </td> <td> <xsl:value-of select="msa:LastInvited"/> </td> <td> <xsl:value-of select="msa:TalkCoordinator/msa:Name"/> </td> <td> <xsl:value-of select="msa:Time"/> </td> </tr> </xsl:template> </xsl:stylesheet> 我评论了我的 if 子句并添加了测试: <xsl:value-of select="count(CongregationDatabaseReport/CongregationList[Congregation=current()])"/> 但这行不通。我有一份教会名单和更大的完整数据库。我首先对较大的数据库进行排序,然后迭代条目,如果该会众名称在我的其他列表中,则处理它。 但它不喜欢我的count电话。似乎 CongregationDatabaseReport 路径在这种情况下无效? 我确实更新了它并确认current()/msa:Name返回了会众名称。所以我知道我需要那个。但是要比较的教会列表......嗯。 使用 xmlstarlet(使用问题中的第一个 xml)计算 Congregation,将返回 2: xmlstarlet sel -t -v "count(/CongregationDatabaseReport/CongregationList//Congregation)" input.xml xmlstartlet 提供了一种输出 XSLT 模板的方式,(在上面添加 -C 时: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common" version="1.0" extension-element-prefixes="exslt"> <xsl:output omit-xml-declaration="yes" indent="no"/> <xsl:template match="/"> <xsl:call-template name="value-of-template"> <xsl:with-param name="select" select="count(/CongregationDatabaseReport/CongregationList//Congregation)"/> </xsl:call-template> </xsl:template> <xsl:template name="value-of-template"> <xsl:param name="select"/> <xsl:value-of select="$select"/> <xsl:for-each select="exslt:node-set($select)[position()&gt;1]"> <xsl:value-of select="'&#10;'"/> <xsl:value-of select="."/> </xsl:for-each> </xsl:template> </xsl:stylesheet> 但是在阅读问题时我迷失了,不知道你想数什么,以及你想用这个数做什么...... 您能否提供“所需的输出”,并分享您使用哪些 XML(或多个 XML?)作为输入?

回答 1 投票 0

注释 <xref> 标签并保持文本为纯文本,如果部分/@id 与文件夹内 xml 或文件夹外 xml 文件不匹配

如果同一文件夹xml文件或其他文件夹xml文件中的section/@id不匹配,我们要注释标签: 每个文件夹都有多个/单个 xml 文件和 和部分...

回答 1 投票 0

为 Visual Studio 2022 调试器启用 XPath/XSLT 文档功能

我正在编写一个包含 XSLT 的 C# 程序。 Visual Studio 对我的 XSLT 发出以下警告: 禁止执行“document()”函数。使用 XsltSettings.EnableDocumentFunct...

回答 1 投票 0

XSLT 用于将平面 XML 与多个嵌套部分分组

我想要通过在另一个区域中重复部分 xml 来转换平面 XML 数据。 我有以下 XML: <

回答 1 投票 0

XSLT 可同时分组并删除重复项

下面是我的输入 XML。我想根据用户名对 XML 下面进行分组,并删除 HierarchyLocation 中的任何重复项 下面是我的输入 XML ...

回答 2 投票 0

如何使用 XSLT 从 xml 中删除根元素?

下面是输入和预期的 XML 格式。我尝试了一些模板,但不起作用。 输入 XML: ...

回答 1 投票 0

使用 XSLT 编辑 PowerPoint 幻灯片并更改变量的值

我希望能够在 PowerPoint 中对表格进行分组,这可以通过编辑幻灯片的 .xml 文件来实现。我正在尝试改变的值 我希望能够在 PowerPoint 中对表格进行分组,这可以通过编辑幻灯片的 .xml 文件来实现。我正在尝试改变的值 <a:graphicFrameLocks noGrp="1"/>(这里是Table 1)从1到0到处都是。所以每次运行时,最终结果都是 <a:graphicFrameLocks noGrp="0"/> 而不是 <a:graphicFrameLocks noGrp="1"/>。这意味着我要转换这个文件: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"> <p:cSld> <p:spTree> <p:nvGrpSpPr> <p:cNvPr id="1" name=""/> <p:cNvGrpSpPr/> <p:nvPr/> </p:nvGrpSpPr> <p:grpSpPr> <a:xfrm> <a:off x="0" y="0"/> <a:ext cx="0" cy="0"/> <a:chOff x="0" y="0"/> <a:chExt cx="0" cy="0"/> </a:xfrm> </p:grpSpPr> <p:graphicFrame> <p:nvGraphicFramePr> <p:cNvPr id="2" name="Table 2"> <a:extLst> <a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}"> <a16:creationId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" id="{A3412BCC-6021-5BBE-8391-7BA6964B02B8}"/> </a:ext> </a:extLst> </p:cNvPr> <p:cNvGraphicFramePr> <a:graphicFrameLocks noGrp="1"/> </p:cNvGraphicFramePr> <p:nvPr> <p:extLst> <p:ext uri="{D42A27DB-BD31-4B8C-83A1-F6EECF244321}"> <p14:modId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="2165210174"/> </p:ext> </p:extLst> </p:nvPr> </p:nvGraphicFramePr> <p:xfrm> <a:off x="2434021" y="4345735"/> <a:ext cx="4064000" cy="370840"/> </p:xfrm> <a:graphic> <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table"> <a:tbl> <a:tblPr firstRow="1" bandRow="1"> <a:tableStyleId>{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}</a:tableStyleId> </a:tblPr> <a:tblGrid> <a:gridCol w="4064000"> <a:extLst> <a:ext uri="{9D8B030D-6E8A-4147-A177-3AD203B41FA5}"> <a16:colId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="310984077"/> </a:ext> </a:extLst> </a:gridCol> </a:tblGrid> <a:tr h="370840"> <a:tc> <a:txBody> <a:bodyPr/> <a:lstStyle/> <a:p> <a:r> <a:rPr lang="en-US" dirty="0"/> <a:t>NORMAL</a:t> </a:r> </a:p> </a:txBody> <a:tcPr/> </a:tc> <a:extLst> <a:ext uri="{0D108BD9-81ED-4DB2-BD59-A6C34878D82A}"> <a16:rowId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="1744877891"/> </a:ext> </a:extLst> </a:tr> </a:tbl> </a:graphicData> </a:graphic> </p:graphicFrame> <p:graphicFrame> <p:nvGraphicFramePr> <p:cNvPr id="3" name="Table 2"> <a:extLst> <a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}"> <a16:creationId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" id="{3C111815-3269-B8CE-F6AA-E05EA0D31543}"/> </a:ext> </a:extLst> </p:cNvPr> <p:cNvGraphicFramePr> <a:graphicFrameLocks noGrp="0"/> </p:cNvGraphicFramePr> <p:nvPr> <p:extLst> <p:ext uri="{D42A27DB-BD31-4B8C-83A1-F6EECF244321}"> <p14:modId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="205468608"/> </p:ext> </p:extLst> </p:nvPr> </p:nvGraphicFramePr> <p:xfrm> <a:off x="2434021" y="5075929"/> <a:ext cx="4064000" cy="370840"/> </p:xfrm> <a:graphic> <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table"> <a:tbl> <a:tblPr firstRow="1" bandRow="1"> <a:tableStyleId>{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}</a:tableStyleId> </a:tblPr> <a:tblGrid> <a:gridCol w="4064000"> <a:extLst> <a:ext uri="{9D8B030D-6E8A-4147-A177-3AD203B41FA5}"> <a16:colId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="310984077"/> </a:ext> </a:extLst> </a:gridCol> </a:tblGrid> <a:tr h="370840"> <a:tc> <a:txBody> <a:bodyPr/> <a:lstStyle/> <a:p> <a:r> <a:rPr lang="en-US" dirty="0"/> <a:t>GROUPABLE</a:t> </a:r> </a:p> </a:txBody> <a:tcPr/> </a:tc> <a:extLst> <a:ext uri="{0D108BD9-81ED-4DB2-BD59-A6C34878D82A}"> <a16:rowId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="1744877891"/> </a:ext> </a:extLst> </a:tr> </a:tbl> </a:graphicData> </a:graphic> </p:graphicFrame> </p:spTree> <p:extLst> <p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}"> <p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="851650981"/> </p:ext> </p:extLst> </p:cSld> <p:clrMapOvr> <a:masterClrMapping/> </p:clrMapOvr> </p:sld> 进入此文件 第二个表Table 2可按预期分组,即<a:graphicFrameLocks noGrp="0"/>,但我手动制作了该表,显然我想自动化此过程。 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"> <p:cSld> <p:spTree> <p:nvGrpSpPr> <p:cNvPr id="1" name=""/> <p:cNvGrpSpPr/> <p:nvPr/> </p:nvGrpSpPr> <p:grpSpPr> <a:xfrm> <a:off x="0" y="0"/> <a:ext cx="0" cy="0"/> <a:chOff x="0" y="0"/> <a:chExt cx="0" cy="0"/> </a:xfrm> </p:grpSpPr> <p:graphicFrame> <p:nvGraphicFramePr> <p:cNvPr id="2" name="Table 2"> <a:extLst> <a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}"> <a16:creationId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" id="{A3412BCC-6021-5BBE-8391-7BA6964B02B8}"/> </a:ext> </a:extLst> </p:cNvPr> <p:cNvGraphicFramePr> <a:graphicFrameLocks noGrp="0"/> </p:cNvGraphicFramePr> <p:nvPr> <p:extLst> <p:ext uri="{D42A27DB-BD31-4B8C-83A1-F6EECF244321}"> <p14:modId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="2165210174"/> </p:ext> </p:extLst> </p:nvPr> </p:nvGraphicFramePr> <p:xfrm> <a:off x="2434021" y="4345735"/> <a:ext cx="4064000" cy="370840"/> </p:xfrm> <a:graphic> <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table"> <a:tbl> <a:tblPr firstRow="1" bandRow="1"> <a:tableStyleId>{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}</a:tableStyleId> </a:tblPr> <a:tblGrid> <a:gridCol w="4064000"> <a:extLst> <a:ext uri="{9D8B030D-6E8A-4147-A177-3AD203B41FA5}"> <a16:colId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="310984077"/> </a:ext> </a:extLst> </a:gridCol> </a:tblGrid> <a:tr h="370840"> <a:tc> <a:txBody> <a:bodyPr/> <a:lstStyle/> <a:p> <a:r> <a:rPr lang="en-US" dirty="0"/> <a:t>NORMAL</a:t> </a:r> </a:p> </a:txBody> <a:tcPr/> </a:tc> <a:extLst> <a:ext uri="{0D108BD9-81ED-4DB2-BD59-A6C34878D82A}"> <a16:rowId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="1744877891"/> </a:ext> </a:extLst> </a:tr> </a:tbl> </a:graphicData> </a:graphic> </p:graphicFrame> <p:graphicFrame> <p:nvGraphicFramePr> <p:cNvPr id="3" name="Table 2"> <a:extLst> <a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}"> <a16:creationId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" id="{3C111815-3269-B8CE-F6AA-E05EA0D31543}"/> </a:ext> </a:extLst> </p:cNvPr> <p:cNvGraphicFramePr> <a:graphicFrameLocks noGrp="0"/> </p:cNvGraphicFramePr> <p:nvPr> <p:extLst> <p:ext uri="{D42A27DB-BD31-4B8C-83A1-F6EECF244321}"> <p14:modId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="205468608"/> </p:ext> </p:extLst> </p:nvPr> </p:nvGraphicFramePr> <p:xfrm> <a:off x="2434021" y="5075929"/> <a:ext cx="4064000" cy="370840"/> </p:xfrm> <a:graphic> <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table"> <a:tbl> <a:tblPr firstRow="1" bandRow="1"> <a:tableStyleId>{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}</a:tableStyleId> </a:tblPr> <a:tblGrid> <a:gridCol w="4064000"> <a:extLst> <a:ext uri="{9D8B030D-6E8A-4147-A177-3AD203B41FA5}"> <a16:colId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="310984077"/> </a:ext> </a:extLst> </a:gridCol> </a:tblGrid> <a:tr h="370840"> <a:tc> <a:txBody> <a:bodyPr/> <a:lstStyle/> <a:p> <a:r> <a:rPr lang="en-US" dirty="0"/> <a:t>GROUPABLE</a:t> </a:r> </a:p> </a:txBody> <a:tcPr/> </a:tc> <a:extLst> <a:ext uri="{0D108BD9-81ED-4DB2-BD59-A6C34878D82A}"> <a16:rowId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="1744877891"/> </a:ext> </a:extLst> </a:tr> </a:tbl> </a:graphicData> </a:graphic> </p:graphicFrame> </p:spTree> <p:extLst> <p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}"> <p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="851650981"/> </p:ext> </p:extLst> </p:cSld> <p:clrMapOvr> <a:masterClrMapping/> </p:clrMapOvr> </p:sld> 更新1 我添加了<xsl:copy>,否则代码将不会给出输出。更新2 我也尝试使用此代码,但出现错误,它的格式不正确。 基于this问题和its答案,我制作了下面的XSLT,我通过从VBA启动它来运行它(用this修复了之前的一个错误),我得到了: Error: a reference to variable or parameter 'noGrp' cannot be resolved. The variable or parameter may not be defined, or ir may not be in scope.我对 XSLT 不太实用,解决方案可能很简单。 我尝试的第一个 XSLT <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:safe="http://www.esa.int/safe/sentinel-1.0" xmlns:ext="http://exslt.org/common" xmlns:p="p" xmlns:a="a" exclude-result-prefixes="ext p" > <xsl:template match="/"> <xsl:copy> <xsl:variable name="graphicFrameLocks" select="//p:sld/p:cSld [p:spTree[p:nvGrpSpPr[p:grpSpPr[p:graphicFrame[p:nvGraphicFramePr[p:cNvGraphicFramePr[@a:graphicFrameLocks='noGrp']]]]]]]"/> <xsl:variable name="noGrp"> <xsl:choose> <xsl:when test="$noGrp"> <xsl:value-of select="1"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="0"/> </xsl:otherwise> </xsl:choose> </xsl:variable> </xsl:copy> </xsl:template> </xsl:stylesheet> 我尝试的第二个 XSLT <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> <xsl:for-each select="//a:graphicFrameLocks"> <xsl:if test="@noGrp='1'"> <xsl:attribute name="noGrp">0</xsl:attribute> </xsl:if> </xsl:for-each> </xsl:copy> </xsl:template> </xsl:stylesheet> 更新3 我能够更改该值,但不能通过 XSLT,因此问题仍然存在。

回答 0 投票 0

如何在 xslt 中的表格单元格内创建实际的交互式复选框

我是 XSLT 世界的新手。请在下面找到我的查询: 我正在使用 XSLT 在报告中创建一个表。 调用 XSLT 文件的 XML 如下所示: ...

回答 0 投票 0

xsl:如何拆分字符串?

我想将分号 (;) 上的地址拆分为由 分隔的行: 例如如果 address=123 Elm Street,我想输出 123 Elm Street, 但是如果地址=123 Elm Street;PO Box 222,我想要...

回答 3 投票 0

花括号中的 XSL 变量

我正在使用 xsl 将带有属性的标签添加到 xml。我需要在 w:t="${para1}" 条件下执行此操作。当对 para1 进行硬编码时,该过程有效。但是,当我定义 $variable='para1' 并使用 $var...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.