Jump to content

jkamp

Members
  • Posts

    4
  • Joined

  • Last visited

jkamp's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Now this may be a dumb question, but this is my first time starting a topic on this this forum. How do you mark the topic as solved?
  2. I was using an XSLT 1.0 processor and the code you gave for that worked like a charm. Thank you so much for your help.
  3. Sorry, no that wasn't the result for the sample xslt file. That result is with using match="/". When using match="/metadatareport" I get values, but there are around 50 <metadatavalue> elements and I get the values of all 50 of them, not just the two that i wrote the value-of select statements for.
  4. Hi, I am currently trying to use an xslt transform to select data out of one xml file and put it in another. Now I have a little experience with xml, but am completely new to xslt. Here is what I have so far. Part of the XML File: <?xml version="1.0" encoding="UTF-8" ?><metadatareport xmlns="http://www.callassoftware.com/ns/pdftoolbox/1.0"'>http://www.callassoftware.com/ns/pdftoolbox/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.callassoftware.com/ns/pdftoolbox/1.0 metadatareport.xsd"> <documents><document><metadata><metadatavalue property_id="xmpMM:TV_SONumber">000_199_SO</metadatavalue><metadatavalue property_id="xmpMM:TV_ArtworkApproval">Yes</metadatavalue> XSLT File: <?xml version="1.0" encoding="UTF-8"?><!-- DWXMLSource="_00IRG_000_199_SO-IM_000_003_805_L-.xml" --><xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions"><xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"><xsl:element name="field-list"> <xsl:element name="field"> <xsl:element name="tag">SO Number</xsl:element><xsl:element name="value"><xsl:value-of select="metadatareport/documents/document/metadata/metadatavalue[@property_id=xmpMM:TV_SONumber]"/></xsl:element> </xsl:element><xsl:element name="field"> <xsl:element name="tag">Artwork Approved</xsl:element><xsl:element name="value"><xsl:value-of select="metadatareport/documents/document/metadata/metadatavalue[@property_id=xmpMM:TV_ArtworkApproval]"/></xsl:element></xsl:element></xsl:element> </xsl:template></xsl:stylesheet> This is the output I am getting: <?xml version="1.0" encoding="UTF-8"?><field-list><field><tag>SO Number</tag><value/></field><field><tag>Artwork Approved</tag><value/></field></field-list> Now the output for the most part is what I want. The problem is that value element in the output is blank, so there must be something wrong with my value-of statement. I have tried multiple things to try and fix it; however, I am very new to xslt, so I am not really sure how to fix this. So if anybody could help me figure out how to select those values from the xml file or give some advice on what I am doing wrong, it would be greatly appreciated. Thanks for your time.
×
×
  • Create New...