<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*[contains(@class, ' topic/topic topic/concept ')]">
<xsl:for-each select="*[contains(@class, ' topic/foreign category-d/category
')]">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE concept SYSTEM "aimlDomain.dtd">
<?xml-stylesheet type="text/xsl" href="aimlTest.xsl"?>
<concept>
<category>
<pattern>_ TOPIC ELEMENT ATTRIBUTE</pattern>
<template><srai>REQUIRED TOPIC AND MAP ELEMENT ATTRIBUTES</srai>
</template>
</category>
<category>
<pattern>TOPIC ELEMENT ATTRIBUTE _</pattern>
<template><srai>REQUIRED TOPIC AND MAP ELEMENT ATTRIBUTES</srai>
</template>
</category>
</concept>
Your starting match statement uses an incorrect class attribute, so it would not match anything:
<xsl:template match="*[contains(@class, ' topic/topic topic/concept ')]">
The final class attribute token for the <concept> element is concept/concept, not topic/concept.
Generally speaking you shouldn't include both tokens in there, because while the tokens must remain the same, the value would be valid with more whitespace in between topic and concept. Try just using the correct concept token:
<xsl:template match="*[contains(@class, ' concept/concept ')]">
Robert D. Anderson DITA-OT lead and Co-editor DITA 1.3 specification Marketing Services Center |
E-mail: roba...@us.ibm.com 11501 BURNET RD,, TX, 78758-3400, AUSTIN, USA | ![]() |
--
You received this message because you are subscribed to the Google Groups "DITA-OT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dita-ot-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<xsl:template match="*[contains(@class, ' concept/concept ')]">
--
You received this message because you are subscribed to the Google Groups "DITA-OT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dita-ot-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
java -jar Saxon-HE-9.8.0-5.jar -s:test1.dita -xsl:aimlTest.xsl -o:output-file.xml
<?xml version="1.0" encoding="utf-8"?>
<concept id="test"> <title>This file is for test</title> <conbody> <p> <category-ai> <pattern>WHAT IS DITA</pattern> <template>DITA is kind of content organization stucture.</template> </category-ai> <category-ai> <pattern>WHAT IS DITA</pattern> <template>DITA is kind of content organization stucture.</template> </category-ai> <category-ai> <pattern>WHAT IS DITA</pattern> <template>DITA is kind of content organization stucture.</template> </category-ai> </p> </conbody></concept>
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="p"> <xsl:for-each select="category-ai">
<xsl:copy-of select="."/> </xsl:for-each> </xsl:template></xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
This file is for test <category-ai> <pattern>WHAT IS DITA</pattern> <template>DITA is kind of content organization stucture.</template> </category-ai><category-ai> <pattern>WHAT IS DITA</pattern> <template>DITA is kind of content organization stucture.</template> </category-ai><category-ai> <pattern>WHAT IS DITA</pattern> <template>DITA is kind of content organization stucture.</template> </category-ai>