Copy link to clipboard
Copied
Hi there,
Brand new to FrameMaker and grateful for any help!
I have several elements that contain text in my XML that I want FrameMaker to omit if the attribute display="false" is present? Can I drop/omit an element based on an attribute's value, but not drop the child element?
example:
Copy link to clipboard
Copied
Do you want to omit it from FrameMaker on import from XML? Or do you want to see it in FrameMaker but omit it when you save as XML?
Either way, can you post an after sample of your XML? Thanks.
Copy link to clipboard
Copied
Would this be your sample input with the nesting in place?
<?xml version="1.0" encoding="UTF-8"?>
<option1>
<feedisplay display="true">Text in the output</feedisplay>
<option2>
<feedisplay display="true">Text in the output</feedisplay>
<option3>
<feedisplay display="false">Text I want ignored/omitted in the output</feedisplay>
<option4>
<feedisplay display="true">Text in the output</feedisplay>
</option4>
</option3>
</option2>
</option1>
Copy link to clipboard
Copied
Good morning Frameexpert!
Yes, your example of the input is correct. Thank you for your help! I've tried drop and unwrap with no such luck. I'm importing the XML and the output is a pdf which I do not want that text included in. I hope that helps clarify things. 🙂
Copy link to clipboard
Copied
This XSL stylesheet, which can be applied to your content on export to XML,
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="3.0">
<xsl:output indent="1"/>
<xsl:template match="feedisplay[@display='false']">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:mode on-no-match="shallow-copy"/>
</xsl:stylesheet>
will give you this output:
<?xml version="1.0" encoding="UTF-8"?>
<option1>
<feedisplay display="true">Text in the output</feedisplay>
<option2>
<feedisplay display="true">Text in the output</feedisplay>
<option3>
<option4>
<feedisplay display="true">Text in the output</feedisplay>
</option4>
</option3>
</option2>
</option1>
Find more inspiration, events, and resources on the new Adobe Community
Explore Now